INKEY$ INput KEY string
Function
INKEY$ is used to detect the pressing of the keys on the keyboard.
How to use INKEY$
INKEY$ requires no argument and is generally used to assign a character to a string variable or to test for a particular character, for example
70 LET a$=INKEY$
130 IF INKEY$="N" THEN STOP
On execution, INKEY$ returns the character given by the key that is being pressed at that instant. If no key is being pressed, then INKEY$ returns a null (empty) string (""). Note that INKEY$ distinguishes between capital and lower-case letters and other shifted and un-shifted characters. (Use IN to detect any key without distinguishing characters).
Unlike INPUT, INKEY$ does not wait but goes immediately to the next statement. It is therefore normally placed inside a loop that repeats until the required key is pressed.
Example
This line suspends operation until the Y key is pressed (without CAPS SHIFT or CAPS LOCK).
60 IF INKEY$<>"y" THEN GO TO 60
Format
- INKEY$
See also