

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.




 
!$KEY
................
! flush the keyboard buffer
! --------------------------------
! you can use POKE(198,0) in C-64 
! ERRE version
! --------------------------------
REPEAT
  GET(K$)
UNTIL K$=""
 
PRINT("Press Y or N to continue")
REPEAT
  GET(K$)
UNTIL INSTR("YyNn",K$)<>0
!
! with C-64 you must write a line like 
! UNTIL K$="Y" OR K$="N"
!  
 
PRINT("The response was ";K$)
.................
 