English
Language : 

NSB8 Datasheet, PDF (63/158 Pages) List of Unclassifed Manufacturers – BASIC interpreter for Z80 family
ITALIAN TECHNOLOGY
grifo®
READ
STATEMENT:
READ <list of variables>
ACTION:
For each variable in the variable list, the next sequentially available data element from the program’s
DATA statements is assigned to that variable.
EXAMPLE PROGRAM:
5 REM Example of READ
10 READ A,B
20 READ C(3),Q$
30 PRINT A,B, C(3), Q$
40 READ X
50 PRINT X
60 DATA 1,2,3,” HI”,4
Running this program yields the output:
1 2 3 HI
4
REMARKS:
The variable and the corresponding constant in a DATA statement must be of the same type (i.e., a
numeric constant may only be READ into a numeric variable, and a string constant into a string
variable).
A special internal pointer allows BASIC to keep track of the current data element. When a program
is run, this pointer is initially set to the first data element in the program’s first DATA statement, or
to end of data if there are no DATA statements in the program.
When a data value is READ into a variable, the data pointer moves to the next element in the DATA
statement. If there is noo more data in the statement, the pointer is moved to the first element in the
next DATA statement which occurs in the program. This process continues until there are no more
DATA statements, at which time the pointer or set to end of data. After this happens, should a READ
be attemped, it will result in a program error. Unless a RESTORE statement is executed, each data
item may be READ once and only once, in the order in which it appears in the program text.
ERROR MESSAGES:
READ ERROR
Either an attempt was made to read data once the end of data condition occurred (without the
execution of an intervening RESTORE), or the value was not of the same type ad the variable to
which it was to be assigned.
SEE ALSO:
Statement DATA
Statement RESTORE
NSB8
Rel. 5.10
Page 51