10-21-2024, 10:15 PM
(10-21-2024, 07:53 PM)Pete Wrote: Wouldn't it be nice to have this feature for Data Restore?Hi Pete
On x Restore data1, data2, data3
instead of needing to code...
Select Case x
Case 1: Restore data1
Case 2: Restore data2
Case 3: Restore data3
End Select
data1:
data eof
data2:
data eof
data3:
data eof
Be sure to post your hate comments in a respectful, non-micro-aggressive and culturally appropriate manner. Oh who am I kidding? Comment however the hell you want!
Pete
what do you think about this alternative solution?
Code: (Select All)
Rem demo Restore : On x Restore idea
For x = 1 To 4
On x GOSUB data1, data2, data3, data4
Read number, nam$, Order$
Print number, nam$, Order$
Next
End
data1:
Restore data1
Return
Data 1,one,the first
data2:
Restore data2
Return
Data 2,two,the second
data3:
Restore data3
Return
Data 3,three,the third
data4:
Restore data4
Return
Data 4,four,the forth
the trick is to heading the label of data selected with a restore to itself and a return to come back to the main loop of reading data.
Yes it use GOSUB and not GOTO. But if you like you can put a label at the start of reading instructions and coming back GOTO to that label from data area.