

Task

Obtain a valid   Y   or   N   response from the keyboard.

The keyboard should be flushed, so that any outstanding key-presses are removed, preventing any existing   Y   or   N   key-press from being evaluated.

The response should be obtained as soon as   Y   or   N   are pressed, and there should be no need to press an   enter   key.




10  LET C =  PEEK (49168): REM CLEAR KEYBOARD
20  PRINT "PRESS Y OR N TO CONTINUE"
30  GET K$
40  IF K$ <  > "Y" AND K$ <  > "N" THEN 30
50  PRINT "THE RESPONSE WAS ";K$
 