FutureBasic Logo

<<    Index    >> FutureBasic

restore   statement

restore [ expr ]

This statement is used in conjunction with the data and read statements. It resets an internal pointer which tells FutureBasic 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.

data Able, Baker
data Kane, Dread
data Echo
for i = 1 to 5
read x$
print x$,
restore 3
read x$, y$
print x$, y$

program output:
Able Baker Kane Dread Echo
Dread Echo

See also
read; data