READ¶
Function¶
READ is used to input constants previously defined in a DATA statement.
Syntax¶
READ Variable 1, Variable 2, ….Variable n
Examples¶
READ X
sets X equal to the current DATA constant.
For example the program:
10 DIM D!(10):DIM A$(10,10)
20 DATA 3,4,5,2/3,"HELLO"
30 READ A,B,C,D!(0),A$(1)
40 PRINT A;B;C;D!(0);A$(1)
Prints:
3 4 5 .66666666666667 HELLO
with A, B, C equal to three sequential DATA constants, D!(0) a double precision constant and A$(1) a string expression.
Remarks¶
The constants are read sequentially until exhausted, when an error will result. The sequence may be restarted by using RESTORE.
The variable type in READ must be the same as the corresponding DATA items: if not, a READ ERROR will occur.