Gosub : Return
Syntax
Gosub MyLabel MyLabel: ... Return
Description
Gosub stands for 'Go to sub routine'. A label has to be specified after Gosub then the programme will continue at the label position until it encounters a Return. When a return is reached, the programme is transferred below the Gosub. Gosub is very useful when building fast structured code.
Example : a = 1 b = 2 Gosub ComplexOperation PrintNumberN(a) End ComplexOperation: a = b*2+a*3+(a+b) a = a+a*a Return
Syntax
FakeReturn
Description
When you want to jump from a sub routine (with the command Goto) to another part in the code outside of this sub routine, you need to use a FakeReturn which simulate a return without do it really. If you don't use it, your program will crash. This function should be useless because a well constructed program don't use Goto. But sometimes, for speed reason, it could help a bit.
Example: Gosub SubRoutine1 SubRoutine1: ... If a = 10 FakeReturn Goto Main_Loop Endif Return