

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.




[loop] cls                ' Clear screen
html "Click Y or N"                      ' no other options
      button #y, "Y", [Y]                '   they either click [Y]
      button #n, "N", [N]                '   or they click [N]
html "<br>";msg$                         ' print message showing what they entered
wait
[Y] msg$ = "You entered [Y]es": goto [loop]
[N] msg$ = "You entered [N]o" : goto [loop]
 