READ, DATA ☆☆☆
assigns the data written in the DATA statements to the variables.
DATA Statements describes the data that shall be read by the READ statements.
The data items are written in DATA statements punctuated by commas.
The data may extent over more than one DATA statement.
In that case, unlike an input reply, no comma is put on the tail.
10 DATA 34,78,13,54 20 READ a,b,c,d
10 DATA 34,78 15 DATA 13,54 20 READ a,b,c,d
10 DATA 34,78,13,54 20 READ a,b 25 READ c,d
Note that only constants can be written in DATA statemrnts.
That is, no READ statments can calculate expressions. For example, the following is wrong in syntax.
10 DATA 1/2+SQR(3)/2 20 READ x 30 END
Data items that is to be assigned to string variables are written enclosed in double quotation marks.
10 DATA "Tanaka",168
20 READ N$,L
On some conditions, data items can be written unquoted. For detail, see the Full BASIC standard.
10 DATA "I am a boy." , ABC
20 READ A$,B$
30 PRINT A$,B$
All the items written in the DATA statements of a program unit forms a single sequence of data.
Data items are read in written order in the program unit.
let the READ statement that shall be executed next read from the first item.
The READ statement that shall be executed next shall read from the item located in the DATA statement that is labeled line_number .
The scope of DATA statements is the program unit.
Data is independent for each program unit.