BeSly Software Solutions About yab Demos About us Admin


gosub -- continue execution at another point within your program (and return later)

gosub foo 


label foo 

gosub remembers the current position within your program and then passes the flow of execution to another point (which is normally marked with a label). Later, when a return- statement is encountered, the execution is resumed at the previous location.
gosub is the traditional command for calling code, which needs to be executed from various places within your program. However, with subroutines yab offers a much more flexible way to achieve this (and more). Therefore gosub must to be considered obsolete.

print "Do you want to exit ? "
gosub ask 
if (r$="y") exit 

label ask 
input "Please answer yes or no, by typing 'y' or 'n': ",r$ 

Related: return, goto, sub, label, on gosub