Computer Science Canada

Skip line when user presses enter

Author:  canmovie [ Wed Sep 15, 2010 4:05 pm ]
Post subject:  Skip line when user presses enter

What is it you are trying to achieve?
I'm trying to put a command so turing will skip to the next line when the user presses Enter.
What is the problem you are having?
Don't know how to do that

Describe what you have tried to solve this problem
I went to turing help and tried Input.Key.Dow.10


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
put "Press any key then enter to continue"
get Input.KeyDown.10


Turing:


put "Press any key then enter to continue"
get Input.KeyDown.10



Please specify what version of Turing you are using
<Answer Here>

Author:  mirhagk [ Wed Sep 15, 2010 8:06 pm ]
Post subject:  RE:Skip line when user presses enter

Input.KeyDown(KEY_ENTER) provides a cleaner way of doing it. (I think that's what it is)

Anyways, it returns an array of true/false values, so you pass it a character array and then use an if statement like so

Turing:

var chars:array char of boolean
Input.KeyDown(chars)
if (chars(KEY_ENTER) then
      %do rest of it
end if

Now to put a newline you can simply do
Turing:

put ""

And to wait until the user presses a key you can do
Turing:

Depending on what you want to do you can just use that.


: