

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.




if var.end=0 then
var.end=0
debug="Press the Y key or the N key to continue:"
endif
if pressed(Key.Y)and var.end=0 then
var.end=1
debug="You pressed the Y key."
endif
if pressed(Key.N)and var.end=0 then
var.end=1
debug="You pressed the N key."
endif