Since goto doesn't exist, how do you jump to a label?
Thanks.
How do you jump to a label within a procedure?
- Random Terrain
- Posts: 63
- Joined: Fri Jul 09, 2021 9:48 pm
- Location: USA
- Contact:
Re: How do you jump to a label within a procedure?
Use "If/Else/Endif", "Repeat/Until", "Select/Case/EndSelect", etc...
If you post some code of what you have so far or are trying to accomplish it would be easier to show how to code it properly.
If you post some code of what you have so far or are trying to accomplish it would be easier to show how to code it properly.
Re: How do you jump to a label within a procedure?
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.
I believe that you can change your code so that you no longer need Goto & Co.
- Random Terrain
- Posts: 63
- Joined: Fri Jul 09, 2021 9:48 pm
- Location: USA
- Contact:
Re: How do you jump to a label within a procedure?
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?
Does that sound right?
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?
Re: How do you jump to a label within a procedure?
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?
Example...
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
- Random Terrain
- Posts: 63
- Joined: Fri Jul 09, 2021 9:48 pm
- Location: USA
- Contact: