back to Command Reference
[All Models]
Assigns a specified number of characters from the keyboard to a variable.
INPUT$ ( number of characters )
└────────┬─────────┘
Numeric expression
number of characters: Numeric expression truncated to an integer in the range of 0 <= number of characters <= 256
INPUT$.
BRK: Halts program execution.
One-key commands and one-key functions: Return a null string.An undocumented variant INPUT$(n,@) is available. This form reads n characters
from the keyboard silently – the characters are not echoed to the display and no
cursor is shown, similar to standard INPUT$. The @ parameter distinguishes this
from the standard form and may be used in situations where silent input without any
visual feedback is desired, such as password entry or hidden key polling.
A$ = INPUT$(1,@)
10 PRINT "ENTER SECRET CODE";
20 ID$=INPUT$(4)
30 IF ID$<>"9876" THEN 10
40 PRINT: PRINT "OK"
Checks for validity of input secret code 9876.