You're browsing the old v2.x documentation. This version is no longer maintained. Click here to go the v3.x documentation.



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.


print "press a key"
  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.