Name
GetKey -- get the key that is pressed in the console (V11.0)
Synopsis
key$ = GetKey()
Function
This function will return the key that is currently pressed in the console. If no key is down, an empty string will be returned. Note that this is a low-level function and only standard English characters and numbers will work reliably across all platforms. If you need to query the state of special keys like the function keys, escape, cursor keys etc., you need to use high-level functions from the console library instead.

Note that this is a console function. It will only listen to key presses that happen in the console. If you want to learn about key presses in Hollywood displays, you need to use functions like WaitKeyDown(), IsKeyDown() or event handlers like OnKeyDown instead.

Also note that of course the same thing can also achieved by using functions from the console library, but the console library isn't available on all platforms and also has a dependency on the (n)curses library on some platforms. GetKey(), however, works on all platforms, except on Android and iOS of course.

Inputs
none

Results
key$
the key that is currently pressed or an empty string if no key is down

Show TOC