in BASIC ROM:
|List of all BASIC keywords|
Type: Command General Programming-Syntax: INPUT ["<text/string>";]<Variable>[,<Variable>...]
The BASIC command INPUT is used to read data from the keyboard into one or more supplied variables. The INPUT command prints the optional text followed by a question mark (?) and then activates the screen editor for user input. User-entered data is stored in the supplied variables (which can be of type string, floating point or integer) after the user presses the . An extra question mark printed after is pressed, means the INPUT command is waiting for additional data of the given variables. The data is separated by commas for more than one input variable. If additional data is entered beyond the required variables, the BASIC error "?EXTRA IGNORED" will be showed. Any extra data is not stored. If the user presses without providing any data, the contents of the variables remains unchanged.
If the user supplies data that doesn't match the type of the supplied variables (for example, by providing a text with letters for an integer variable) the BASIC error "?REDO FROM START" will be displayed which means that the data has to be entered again. To avoid this type of error, it is recommended to use string variables for all data types. In direct mode INPUT results in the BASIC error "?ILLEGAL DIRECT ERROR".
Examples[edit | edit source]
10 INPUT "First input, please "; A$ 20 INPUT "Only numbers (2-times) "; A1, A2% 40 PRINT: PRINT "Your input was: " A$, A1, A2% 50 PRINT: PRINT "Once again 3 numbers "; 60 INPUT A1%, B, Z 70 PRINT: PRINT "At last 3 inputs "; 80 INPUT A$, B$, C$ 90 PRINT: PRINT "Your last input was: "; A1%, B, Z, A%, B$, C$
Trivia[edit | edit source]
POKE 19,1(zeropage, current input file number) will omit the output of the "?" and , until reset with
POKE 19,0. In this state the program aborts with message "?FILE DATA ERROR" rather than continuing with the warning message "?REDO FROM START".