Re: Why doesn't this work?

new topic     » goto parent     » topic index » view thread      » older message » newer message

>I am trying to improve a program that prompts for values for a, b, c...l.
>I tried to use the input function, but that didn't work.  So I returned to
>the basics.  This is what I have.

>clear_screen()
>sequence prompt
>atom prompt_loop
>prompt = {97,98,99,100,101,102,103,104,105,106,107,108}
>for prompt_loop = 1 to 12
>print(1,prompt[prompt_loop])
>end for
>abort

>it should print abcdefghijkl.  No, that's wrong.  It should print
>979899100101102103104... but its not even doing that.  It says I'm
>redefining something.  My logic seems OK.  What's wrong?

>--Alan

Alan, you don't need to declare variables to a loop made with "for" loops,
the variable used in this routine will exist only during the loop, and using
for <variable>=<value> to <value> do , don't forget to add the do command at
end of statement, it's vital.
Just to finish, calling abort, don't forget the () ,I mean abort()
Following is your code , now running ok

clear_screen()
sequence prompt
--atom prompt_loop
prompt = {97,98,99,100,101,102,103,104,105,106,107,108}
for prompt_loop = 1 to 12 do
print(1,prompt[prompt_loop])
end for
abort()

See you later.

Eduardo Uemura Okada
du at geniusnet.com.br

PS - It's rare to me, as a beginner, answer a question in this mail list,
hope it helps smile

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu