Liberty BASIC Help Online |
RESTORE
RESTORE
RESTORE [branchLabel]
Description:
RESTORE will reset the reading of DATA statements so that the next READ will get information from the first DATA statement in the program (or the first DATA statement in a function or subroutine, if this is where the RESTORE is executed).
Example:
'show me my data in all uppercase
while string$ <> "end"
read string$
print upper$(string$)
wend
string$ = "" 'clear this for next while/wend loop
'now reset the data reading to the beginning
restore
'show me my data in all lowercase
while string$ <> "end"
read string$
print lower$(string$)
wend
data "The", "Quick", "Brown", "Fox", "Jumped"
data "Over", "The", "Lazy", "Dog", "end"
end
Optionally, you can choose to include a branch label:
'show me my data in all uppercase
while string$ <> "end"
read string$
print upper$(string$)
wend
string$ = "" 'clear this for next while/wend loop
'now reset the data reading to the second part
restore [partTwo]
'show me my data in all lowercase
while string$ <> "end"
read string$
print lower$(string$)
wend
data "Sally", "Sells", "Sea", "Shells", "By", "The", "Sea", "Shore"
[partTwo]
data "Let's", "Do", "Only", "This", "A", "Second", "Time", "end"
end
Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/