How do you jump to a label within a procedure?
Posted: Fri Jul 23, 2021 3:26 pm
Since goto doesn't exist, how do you jump to a label?
Thanks.
Thanks.
- a basic to master the web -
https://forums.spiderbasic.com/
Thanks. So instead of jumping over a section of code if something specific happens, I need to stick that section of code inside of an If-EndIf or a Select-EndSelect?Peter wrote: Fri Jul 23, 2021 3:46 pm Goto and Gosub no longer exist for a good reason. The code becomes very unreadable (spaghetti code).
I believe that you can change your code so that you no longer need Goto & Co.
Labels are useful in DataSections (without a label you can't tell it what section of data to use)Random Terrain wrote: Fri Jul 23, 2021 4:11 pm Speaking of labels, the page that mentions labels doesn't seem to have an example. If labels can't be jumped to, why do labels exist in SpiderBasic?
Code: Select all
Restore last
For x=1 To 3
Read a
Debug a
Next
DataSection
first:
Data.i 1,2,3
last:
Data.i 7,8,9
EndDataSection
OK, thanks.Paul wrote: Fri Jul 23, 2021 4:53 pm Labels are useful in DataSections (without a label you can't tell it what section of data to use)