EasyManua.ls Logo

Commodore VIC-20 - Page 377

Commodore VIC-20
404 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Appendix
G:
BASIC
Statements 363
READ
The
READ
statement assigns values from a DATA statement
to
vari-
ables named in the
READ
parameter list.
Format:
READ
var[,var, ... ,var]
READ
is
used
to
assign values to variables.
READ
can take the place
of
multiple assignment statements (see LET
).
READ
statements with variable lists require corresponding DATA
statements with lists
of
constant values. The
data
constants and correspond-
ing variables have
to
agree in type. A string variable can accept any type of
constant; a numeric variable can accept only numeric constants.
The number
of
READ
and DATA statements can differ, but there must
be
an
available DATA constant for every
READ
statement variable. There
can be more
data
items than
READ
statement variables,
but
if there are too
few
data
items the program a borts with
an
?O UT 0 F D AT A error message.
READ
is
generally executed in program mode.
It
can be executed in
immediate mode as long as there are corresponding DATA constants in the
current stored program
to
read from.
Example:
10
DATA
1,2,3
On
completion,
A=l,
B =2,
C=3
20
READ
A,B,C
150
READ
CS,D,FS
On
completion,
C$="STR'~
D =14.5, F$="TM"
160
DATA
STR
170
DATA
14.5,
"TM"
REM
The Remark statement (REM) allows comments to be placed in the
program for program documentation purposes.
Format:
REM
comment
where
comment
is
any sequence
of
characters that
will
fit on the
current SO-column line.
REM
statements are reproduced in program listings, but they are
otherwise ignored. A
REM
statement may be placed
on
a line
of
its own,
or

Other manuals for Commodore VIC-20

Related product manuals