Hi all,
In QBasic DATA is read from the first position that it finds in the BAS file. To read multiple DATA statements into different variables at different times one has to use the RESTORE command in conjunction with a label. Here's an example
REM
DEFINT A_Z
OPTION BASE 1
DIM FirstDim(4)
DIM SecondDim(6)
for t= 1 to 4
read z
FirstDim(t) =z
next t
'place this data onscreen
for t= 1 to 4
Print FirstDim(t)
next t
'read the second part of the data into the 2nd dim
'we must "RESTORE" to correct place
RESTORE Twice
For t= 1 to 6
read z
SecondDim(t) =z
next t
'place this data onscreen
or t= 1 to 6
Print SecondDim(t)
next t
SLEEP
SYSTEM
'----------- DATA STATEMENTS -----
DATA 1,2,3,4
Twice:
DATA 5,6,7,8,9,0
OlDosLover.