Hi,
I have just succeeded (I think) in implementing the old Basic GOSUB
instruction in Gambas in revision #4530.
I did that, because it is faster than using a plain little function, if
you just need to call a small piece code without needing a specific
context nor arguments.
The syntax is the same as the GOTO instruction (with the same
restrictions on the label):
GOSUB <label>
To return from a GOSUB, you must use the RETURN instruction alone.
<label>:
...
RETURN
Consequently, you cannot use RETURN to return from a subroutine if there
is a pending GOSUB. A little annoyance.
If the function end (or a CATCH instruction) is encountered, the
function is ended like before, even if there are pending GOSUB. In other
words, returning from a GOSUB is always explicit.
Enjoy it!
--
Benoît Minisini
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user