287
RESTORE Directive
Reset Program Data Position
Format
RESTORE [stmtref]
Where:
stmtref
Program line number or label the data read pointer is set to.
Description
Use the RESTORE directive to change the position of the data read pointer. When a
program is first loaded (or following a BEGIN directive), the data read pointer is set
to the start of the program. As the data is read, the pointer is advanced through the
various data statements in the program.
To set the data read pointer to a given location, include a statement reference in the
RESTORE directive. Omit stmtref to set the data read pointer to the default position
at the start of the program. ProvideX returns an End of File message when all data
statements in the program have been read.
See Also
Example
0010 DATA 1,2,3,"Cat"
0020 DATA 4,5,6,"Dog"
0030 READ DATA X,Y,Z,A$,ERR=0050
0040 PRINT X,Y,Z,A$; GOTO 0030
0050 INPUT "Do you want to see the last one again? (Y/N)",X$
0060 IF X$="Y" OR X$="y" THEN RESTORE 0020; GOTO 0030
0070 PRINT " DONE"; STOP
-:run
1 2 3Cat
4 5 6Dog
Do you want to see the last one again? (Y/N)y
4 5 6Dog
Do you want to see the last one again? (Y/N)n
DONE