ln a program mode
IF
...
THEN. the
following
command and statement are
illegal: CONT. DATA. If a
FOR
...
NEXT loop
will
be
following
the THEN, the loop
must
be
completely contained on the
IF
...
THEN
line. Additional
IF
...
THEN
statements may appear
following
the THEN
as
long
as
they are completely con-
tained on the original
IF
...
TH
EN
line. However, Boolean connectors are preferred
to nested
IF
...
THENs. For example. the
two
statements below are equivalent.
but
the second
is
preferred.
10
IF
A$
=
"X"
TH
EN
IF
B = 2
THEN
IF
C>D
THEN
50
10
IF
A$
=
"X"
AND
B = 2 AND
C>D
THEN
50
Examples:
400
IF
X>Y
THEN A = 1
500
IF
M+1
THEN
AG
= 4.5:GOSUB 1000
INPUT
The INPUT statement inputs data items from the keyboard to a program.
Format:
where:
INPUT
{
var
var,var
....
,var
Input
data item
Input
data items
var
msg
is
a string or numeric variable into
which
the
data item
is
to
be
input.
refers to a
prompt
message which, if present.
is
a string enclosed in quotes and followed by a
semicolon.
When
the INPUT statement
is
executed.
PET
BASIC prints a question mark
on the screen requesting
input
of data to the variable or variables listed in the IN-
PUT
statement. The user enters the data and terminates his or her response
with
a
RETURN.
Where
there
is
more than one variable
in
the INPUT statement. data en-
try
is
separated by commas.
?data or ?data,data,
...
,data
If msg
is
present. the string
is
printed before the question mark.
msg?data or msg ?data.data
.....
data
133