READ - DualBrain/bsharp Wiki
To read values from a DATA statement and assign them to variables.
READ list of variables
READ statement must always be used with a DATA statement.
READ statements assign variables to DATA statement values on a one-to-one basis.
READ statement variables may be numeric or string, and the values read must agree with the variable types specified. If they do not agree, a
Syntax error results.
If the number of variables in list of variables exceeds the number of elements in the DATA statement(s), an
Out of data message is printed.
If the number of variables specified is fewer than the number of elements in the DATA statement(s), subsequent
READ statements begin reading data at the first unread element. If there are no subsequent
READ statements, the extra data is ignored.
To reread DATA statements from the start, use the
FOR I = 1 TO 10 READ A(I) NEXT I DATA 3.08, 5.19, 3.12, 3.98, 4.24 DATA 5.08, 5.55, 4.00, 3.16, 3.37
This program segment reads the values from the DATA statements into array
A. After execution, the value of
A(1) is 3.08, and so on. The DATA statement may be placed anywhere in the program; they may even be placed ahead of the
PRINT PRINT "CITY", "STATE", "ZIP" READ C$, S$, Z DATA "DENVER,", "COLORADO", 80211 PRINT C$, S$, Z
This program reads string and numeric data from the DATA statement.