
BASIC PROGRAMMING GUIDE
2-26
INPUT
Syntax: INPUT ["
prompt text
"] [,] [,
variable
...]
Where:
prompt text
= optional text
variable
= list of variables to assign
Function: Program pauses to receive data entered from the console input.
Mode: Run
Use: 100 INPUT "Enter batch number",$(0)
DESCRIPTION
INPUT brings in numeric and string data from the console serial port during execution. Variables are string,
numeric, or both. Variables are separated by a comma. Optional
prompt text
must be enclosed in quotes.
When an optional comma precedes the first
variable,
the question mark prompt character is suppressed and
data entry is on the same line as
prompt text
.
Multiple numeric data may be entered by separating individual values with commas and using <cr> on the
last one. Or, each data entry may be entered using a <cr>.
Strings must be entered with a carriage return.
If you do not enter enough data or the correct type, Basic sends the message TRY AGAIN and
prompt text
after which you must enter
all
the data. If you enter too many characters for the size of allocated STRING
memory, or more numeric values than were requested, Basic discards the extra data, emits the message
EXTRA IGNORED, and continues execution.
RELATED
COM$, GET, STRING
ERRORS
none
EXAMPLE
10 STRING 200,20
20 INPUT "Enter a number, string, and 2 more numbers: ",A,$(0),B,C
30 PRINT "String:",$(0)
40 PRINT "Numbers:",A,B,C
>run
Enter a number, string, and 2 more numbers: 4,Bob
?7,9
String:Bob
4 7 9
Komentarze do niniejszej Instrukcji