Flow-control structures: Difference between revisions

Content added Content deleted
m (→‎{{header|PureBasic}}: Some more meat on the bone)
m (Structure)
Line 816: Line 816:
Return ; Returns to the point in the code where the Gosub jumped from</lang>
Return ; Returns to the point in the code where the Gosub jumped from</lang>
===FakeReturn===
===FakeReturn===
If the command Goto is used within the body of a sub routine, FakeReturn must be used to correct the stack or the program will crash.
<lang PureBasic>Gosub MySub
<lang PureBasic>Gosub MySub


Line 828: Line 829:
EndIf
EndIf
Return</lang>
Return</lang>

If the command Goto is used within the body of a sub routine, FakeReturn must be used to correct the stack or the program will crash.
===OnErrorGoto===
===OnErrorGoto===
This will transferee the program execution to the defined label if an error accrue.
This will transferee the program execution to the defined label if an error accrue.