Futurebasic/Language/Reference/restore

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Syntax[edit | edit source]

RESTORE

Description[edit | edit source]

This statement is used in conjunction with the DATA and READ statements. It resets an internal pointer which tells FB where to find the next DATA item to read. This allows your program to READ the same DATA item(s) more than once if necessary. If you omit the expr parameter, the DATA pointer is reset to point to the first item in the first DATA statement. If you specify expr, the DATA pointer is reset to point to the item immediately following the expr-th item. Thus RESTORE 1 points to the second item; RESTORE 2 points to the third item; and so on.

Example: DATA Able, Baker DATA Kane, Dread DATA Echo FOR i = 1 to 5

  READ x$
  PRINT x$,

NEXT PRINT RESTORE 3 READ x$, y$ PRINT x$, y$ program output: AbleBaker KaneDreaEcho Dread Echo

See Also[edit | edit source]

READ; DATA