READ, DATA ☆☆☆

READ
assigns the data written in the DATA statements to the variables.

DATA
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.

Example 1.

10 DATA 34,78,13,54
20 READ a,b,c,d


Example 2.

10 DATA 34,78
15 DATA 13,54
20 READ a,b,c,d


Example 3.

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.
Example.
10 DATA "Tanaka",168
20 READ N$,L

On some conditions, data items can be written unquoted. For detail, see the Full BASIC standard.
Example
10 DATA "I am a boy." , ABC
20 READ A$,B$
30 PRINT A$,B$
40 END


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.

RESTORE
let the READ statement that shall be executed next read from the first item.

RESTORE line_number
The READ statement that shall be executed next shall read from the item located in the DATA statement that is labeled line_number .

Note.
The scope of DATA statements is the program unit.
Data is independent for each program unit.