
7-6
Section
Details of BASIC Commands
212
read
Syntax:
READ
<variable> {, <variable>}
Description:
Statement. Reads values from
DATA
statements and assigns them to the specified variables.
Remarks:
<variable> is any valid BASIC numeric or character variable name.
READ
statements must always be used in conjunction with
DATA
statements. If no corresponding
DATA
statements exist, or if all of the data has been exhausted with
READ
statements then an “OUT
OF DATA” error (code B004) will occur.
The variables specified in the
READ
statements can be of any type, however the type must match
the type of the value in the corresponding
DATA
statement. If the type of the variable in the
READ
statement does not match the type of the value in the
DATA
statement then a “SYNTAX ERROR”
will occur. The
READ
statement can read a numerical constant as either a string or a number
depending on the type of the variable used in the
READ
statement. However, a string constant must
always be read with a numerical string variable.
When there are two or more
DATA
statements, they are treated as a single list of data items and the
constants in the
DATA
statements are read in the order that they appear in the program. When the
RESTORE
statement is executed, data will be read again starting from the first
DATA
statement.
If all data has been read and the
RESTORE
statement has not been executed then the next
READ
will
result in a “OUT OF DATA” error (code B004).
Examples:
> 10 DATA 10, "HELLO", 1.6, "WORLD"
> 20 READ A, B$, C, D$
> 30 PRINT B$+" "+D$
> 40 PRINT A+C
> RUN
HELLO WORLD
11.6
See also:
DATA
,
RESTORE
rem
Syntax:
REM
[<comment string>]
Description:
Statement. Inserts non-executable comments in a program.
Remarks:
<comment string> is a freely definable string that need not be enclosed in quotes. It can be as long
as the maximum line length.
REM
statements should be used to give titles to programs and to make useful comments to make the
program easier to understand.
All characters on the same line but after the
REM
statement are ignored. It is not necessary to insert
a space between the
REM
keyword and the comment string.
Comments can be added to the end of a line by using a colon to specify the start of a new
statement. Alternatively a single quote character can be used instead for the same effect.
The
REM
keyword cannot be used in
DATA
statements as it will be assumed to be a legal data string.
Examples:
> 10 REM TEST PROGRAM
See also:
Summary of Contents for C200H-ASC11
Page 1: ...C200H ASC11 ASC21 ASC31 ASCII Units Operation Manual Revised June 2000...
Page 2: ...iv...
Page 4: ...vi...