INPUT ["prompt",] var [, ["prompt",] var ...]
The INPUT statement allows the user to assign a value to a variable by typing in the value on the keyboard. A prompt is displayed on the display line. The INPUT statement can specify the prompt, or a question mark (?) will be used by default. To suppress the prompt, specify a prompt string of "".
INPUT can input values for simple variables, full arrays, array elements, or sub-strings. A full array name must be followed by the full array specifier, "(*)". Values for the array must be entered in row major order.
Leading and trailing spaces are ignored. Data values may be entered individually or multiple values may be entered at once. For example:
INPUT A,B$,C(4),D
If multiple values are entered, separate each value with a comma. If too many values are entered, the extra values are ignored. Both quoted and unquoted strings are allowed. Commas are not allowed in unquoted strings, but may appear in quoted strings. To embed one quotation mark in a quoted string, type in two quotation marks at the place you wish to have one appear.
Two consecutive commas cause the corresponding variable to retain its old value. Terminating an input line with a comma or pressing ENTER without entering any data retains the original values for all remaining variables in the list.
Let’s look at a simple program to INPUT a value and assign it to a variable and then examine how to improve it.
DISP "Enter a file name";
INPUT F$
Now let’s see how to do this in just one statement:
INPUT "Enter a file name: ",F$
To provide a default answer we might do the following:
F$ = "STUDENT.DAT"
INPUT "Enter a file name <STUDENT.DAT>: ",F$
If the default answer is OK with the user, he need only press ENTER to accept the default. If it is not OK, he can enter the proper value. Of course, this behavior would need to be documented somewhere in the instructions given to the user.