Computer Science Canada

Inkey in turing

Author:  tum_twish [ Tue Apr 22, 2003 9:49 am ]
Post subject:  Inkey in turing

In QBasic, there is a command that will wait until a key is pressed.

code:

DO
         'expressions
LOOP WHILE inkey$=""


or

code:

DO
       'expressions
        SLEEP
LOOP UNTIL 'statement is true'



Is there a similar command in Turing that will wait until the key is pressed?[/code]

Author:  tomako [ Tue Apr 22, 2003 9:56 am ]
Post subject: 

im thinking getch, but i duno how u can wait til a "certain key"...

Author:  Blade [ Tue Apr 22, 2003 10:51 am ]
Post subject: 

yeah use getch, with a loop... we'll use 'h' as the certian key your waiting for
code:
var anykey:string(1) %for getch the string has to be one character
loop
getch(anykey)
exit when anykey = "h"
put "Thats not the right key, you must press 'h'"
end loop


oh, and check out the tutorials section before you post help, it may clear up a lot of your problems
http://www.compsci.ca/bbs/viewforum.php?f=3

Author:  Homer_simpson [ Tue Apr 22, 2003 11:59 am ]
Post subject: 

code:
var ch:char
loop
exit when getchar = "x"
end loop

"x" can be changed to character u want... Smile

Author:  Tony [ Tue Apr 22, 2003 12:02 pm ]
Post subject: 

you for got to put getch inside the loop Confused And after that it would be exactly what Blade already said.

Author:  Delta [ Tue Apr 22, 2003 1:45 pm ]
Post subject: 

Or use hasch for anykey to be waited upon

code:

loop
exit when hasch
end loop

Author:  Blade [ Tue Apr 22, 2003 2:10 pm ]
Post subject:  Re: Inkey in turing

tum_twish wrote:
In QBasic, there is a command that will wait until a key is pressed.

code:

DO
         'expressions
LOOP WHILE inkey$=""


or

code:

DO
       'expressions
        SLEEP
LOOP UNTIL 'statement is true'



Is there a similar command in Turing that will wait until the key is pressed?[/code]


he said he wanted one so that he can wait until a key is pressed, with hasch it keeps goin past it until a key is pressed

Author:  Homer_simpson [ Tue Apr 22, 2003 2:55 pm ]
Post subject: 

why would u use getch command? (ch = getchar) does it all ... =/

Author:  Office of the Registar [ Fri Apr 25, 2003 9:13 am ]
Post subject: 

strings can be concatenated as well, maybe that's why use getch


: