Chapter
10
I
BASIC
Keywords
INPUT
Statement
INPUT[;]
[ā~promptā;]uariabl[,u~rzabl,
...I
Accepts data from the keyboard and inputs it into
1
or
more
variables. When BASIC encounters this statement,
it
stops exe-
cution and displays
a
question mark. This means that the pro-
gram is waiting for you
to
type something.
Prompt
is
a string constant that BASIC displays before display-
ing the question mark prompt.
Prompt
must be enclosed in quo-
tation marks, and follow the keyword INPUT. If, instead of a
semicolon, you type a comma after
prompt,
BASIC suppresses the
question mark when printing the prompt.
Variable
may be
1
or more string or numeric variables
to
receive
the input.
If
you specify more than
1
variable, separate them by
commas.
If INPUT
is
immediately followed by a semicolon
(;I,
BASIC does
not echo the
[ENTER]
key when you press it as part
of
a response.
When typing multiple pieces
of
data on
1
line, separate the data
items with a comma. The number of data items you supply must
be the same as the number
of
variables you specify.
Responding
to
INPUT with
too
many items or with the wrong
type
of
value (including numeric type) causes BASIC
to
print the
message ā?Redo from start.ā No values are assigned until you
provide an acceptable response.
179