Resets or repositions the current DATA read pointer.
With no argument, RESTORE resets the read position to the start of the program's data stream.
With an argument, RESTORE sets the read position to a specific zero-based DATA offset.
Example
DATA 10, 20
DATA 30
PRINT DATAREAD
PRINT DATAREAD
RESTORE
PRINT DATAREAD
This prints:
Example with offset
DATA 10, 20, 30
RESTORE 1
PRINT DATAREAD
PRINT DATAREAD
This prints:
Behaviour
- RESTORE with no argument resets the data pointer to offset 0.
- RESTORE N moves the data pointer to offset N.
- Offsets are zero-based.
- The offset refers to the internal position within the combined DATA stream, not to a line number.
- An invalid offset produces a runtime error.
- RESTORE affects subsequent calls to DATAREAD, DATAREADR, and DATAREAD$.
See also