INKEY$

Format

string1 = INKEY$

Description

Used to retrieve keystrokes from the keyboard buffer. If a character is waiting in the buffer, string1 will be set to the value of that character, and that character will be removed from the keyboard buffer. If the buffer is empty, string1 will be set to a value of "" (that is, a null string with a length of 0). If an extended key is pressed (for example the function keys F1 through F10), the system variable EXTENDED will be set to 1, otherwise it will contain 0.

Example

LOOP: X$=INKEY$
IF X$="" THEN LOOP:
The above code will cause the program to loop until a key is pressed.

Comments

ASIC provides an extension here over BASICA/GWBASIC. The EXTENDED system variable will allow you to detect special keys as mentioned above. To do so requires an understanding of keyboard scan codes, which is beyond the scope of the ASIC Manual. For more information I would suggest Peter Norton's Programmer Guide to the IBM PC (Microsoft Press).