130 User's
Handbook
to the Atari
400
/
800
Computers
When INPUT
is
used
with
the screen
editor
,
no
OPEN
statement
is
necessary. The program waits
for
input
from
the keyboard
when
an
INPUT statement
is
executed. A question mark
(?)
appears on the screen to remind the
operator
to
enter data.
EXAMPLE
10
DIM
X$(10)
20
INPUT
X,
X$
30
PRINT
X$,
X
RUN
?
45,
JONES,
BILL
JONES,
BILL
45
In the previous example,
line
10
dimensions the string variable
for
10
characters. Line
20
is
an
INPUT statement that requests a
numeric
value
to
assign
to
X,
and a string value
to
assign to
X$.
When the program
is
executed, the INPUT statement causes the
program
to
wait at
line
20
for
input.
Since
no
I/ O channel
is
specified, the
input
is
accepted
from
the
keyboard, and the
prompt
(?)
is
displayed. The user responds
with
two
data items. The value
45
is
entered
for
a value
of
X.
The
string
value
JONES,
BILL
is
entered
for
a value
of
X$.
These
two
data items
could
be entered on separate lines. Notice that the
comma in
the
string value does
not
separate data items.
When each
variable in the INPUT statement
is
assigned a value,
the
program executes the
NEXT
statement (line
30)
.
At
line
30
the
values
of
X$
and X are displayed on the screen.
The
INPUT statement
can
also be
us
ed
with
the
Program
Recorder
to
recover data. When the Program Recorder
is
used,
an
OPEN
statement must be executed
before
an
INPUT
statement
is
encountered. The
OPEN
statement must
include
an
I/ O channel
number,
the operation code
for
input
(4)
, and the
device code
("C).
The
third
argument
of
the
OPEN
statement
is
a special
function
code, and must be zero.
If
any
of
the
arguments
of
an
OPEN
statement are
not
integers, they are
rounded
off.