Wait for a key to be pressed (using INKEY$), and return its ASCII Code.
Waits for a key pressed and returns its ASCII code. It cannot detect multiple keys pressed. This is useful, for example, to program options menus in games were only a single option can be selected.
#include <keys.bas> PRINT "PRESS A KEY" x = GetKey PRINT "You pressed the "; CHR x; " key"
Will print the key pressed. Unlike INKEY$ it returns an Ubyte (ASCII code) which is more efficent that working with strings.
Back to parent page: Keys ibrary