INKEY()

Syntax:

inkey() | inkey!()

The INKEY() function returns the keyboard code of the last pressed key. If no key was pressed, the return value is 0.

The function can return an integer or a byte.

Example:

print "press a key"
loop:
  let key! = inkey!()
  if key! = 0 then goto loop
print "you pressed: ", key!

Note that once the keycode was returned by INKEY(), the input is "consumed", i.e. it won't be returned again on a subsequent function call, even if the key remained pressed.