READ
Format: READ var list
Supported by: COMX BASIC V1.00, Floating Point BASIC 2.2, Pecom 32 BASIC, Pecom 64 BASIC 1.0 and 4.0, Quest Super BASIC 1.4, 3.0, 5.0 and 6.0, RCA BASIC3 V1.1, Telmac SBASIC v 24.3
Similar commands: -
The READ statement is used to read data from the DATA statement and assign that data to a particular variable. Each time the READ statement requests more data, an internal BASIC pointer moves to the next piece of data in the DATA statement. When a DATA statement is out of data, BASIC will search onward for another DATA statement. If none is found, an error message will be returned indicating the lack of data. It is important to keep track of the variable names or string names in the READ statement and the corresponding data in the DATA statement. They must match in form; strings go with strings, and so on. An example of an acceptable DATA/READ statement pair is as follows.
5 DIM A (4) 10 DATA 10, 20, 30, 40 20 FOR A=1 TO 4 30 READ A (A) 40 NEXT 50 READ A$(1), B, C 60 PR A$ (1); B*C 70 DATA "B*C IS EQUAL TO", 20, 30
The result of the above example is that the array A would be loaded as follows:
A(1)=10 A(2)=20 A(3)=30 A(4)=40
Line #60 would result in
B*C IS EQUAL TO 600