BASIC FUNCTIONS
SECTION 5.10
INKEY$
5. 10.5 Function INKEY$ reads the keyboard and returns a single character if
an input is pending on the keyboard.
Syntax A$ = INKEY$
Example 10 A$ = INKEY$
20 IF A$ =
1111
THEN 40
30 PRINT A$
40 GOTO 10
Remarll<s If a key has not been pressed then a null string is
returned. The ASCII code of each key, including control
codes, is read and assigned to the one character string
variable A$.
VER.V09F
The characters entered into the program in this manner are
not displayed on the screen unless explicitly printed (line
30 in the example). One application may be to insert a
pause in a program before displaying another screen of
information:
80 PRINT
11
las t line of last screen"
90 A$=INKEY$:
IF A$=
1111
then 90
100 PRINT"First line of next screen"
If a function key is pressed then a two character string is
returned consisting of the
'A' character and the number of
the key pressed i.e. Pressing Function Key
1 will return
the string "A1" to an INKEY$ function.
PAGE 5 - 117