KEY?

Syntax

KEY?

Explanation

KEY? outputs TRUE if a character is available from the keyboard; otherwise, it outputs FALSE.

Example

The procedure below moves the turtle forward until the R or L keys are pressed to turn the turtle.

TO MOVE


 * FD 5


 * IF KEY? THEN COMMAND


 * MOVE

END

TO COMMAND


 * MAKE "CHOICE READCHAR


 * IF :CHOICE = "R THEN RT 30


 * IF :CHOICE = "L THEN LT 30

END

? MOVE

? RRR

Stopped!