Currently, you can READ values from DATA-lines and use RESTORE to start reading from the top again.
A possible enhancement is to allow a label before a DATA-line, and pass that label to the RESTORE-statement to start reading from that line.
Example:
RESTORE @block1
GOSUB @processData
RESTORE @block2
GOSUB @processData
END
@processData
DO
READ i%
IF i% < 0 THEN EXIT DO
PRINT i%
LOOP
@block1
DATA 1, 2, 3, 4, -1
@block2
DATA 5, 6, 7, 8, -1
A further enhancement is to allow an END-value in a DATA-line that marks the end of a block of DATA-lines. Reading the END-value results in an "out of data" error.
Example:
RESTORE @block1
GOSUB @processData
RESTORE @block2
GOSUB @processData
END
@processData
ON ERROR GOTO @endOfData
DO
READ i%
PRINT i%
LOOP
@endOfData
ON ERROR GOTO 0
@block1
DATA 1, 2, 3, 4, END
@block2
DATA 5, 6, 7, 8, END
Currently, you can READ values from DATA-lines and use RESTORE to start reading from the top again.
A possible enhancement is to allow a label before a DATA-line, and pass that label to the RESTORE-statement to start reading from that line.
Example:
A further enhancement is to allow an END-value in a DATA-line that marks the end of a block of DATA-lines. Reading the END-value results in an "out of data" error.
Example: