key()

Returns True (1) if given keycode corresponding key is pressed.

Syntax:
variable = key( keycode )

A list of mnemonic keycodes is available for your convenience in appendix: Keyboard keycodes.

Example:
prints("press ESC key to exit.")
while not key( k_esc )
    wait(100)
wend