qbasic.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
INKEY$ Function
  Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
Reads a character from the keyboard.
 
INKEY$
 
    ■ INKEY$ returns a null string if there is no character to return.
    ■ For standard keys, INKEY$ returns a 1-byte string containing the
      character read.
    ■ For extended keys, INKEY$ returns a 2-byte string made up of the null
      character (ASCII 0) and the keyboard scan code.
 
Example:
    PRINT "Press Esc to exit..."
    DO
    LOOP UNTIL INKEY$ = CHR$(27)    '27 is the ASCII code for Esc.
 
See Also    Keyboard Scan Codes