User Tools

Site Tools


el:gosub

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

el:gosub [2016/01/01 22:39]
el:gosub [2020/02/28 10:46] (current)
Line 1: Line 1:
 +===== Gosub =====
 +==== Format ====
 +**gosub** //label//\\
 +\\
 +label:\\
 +//statement(s)//\\
 +**return**
  
 +==== Description ====
 +Jumps to the specified label.  Upon encountering a [[Return|Return]] statement the program will continue at the line following the Gosub.  Gosubs may call other gosubs but all variables are shared.
 +==== Example ====
 +
 +<code>
 +a$ = "Hello"
 +gosub double
 +print a$
 +b = 3
 +gosub triple
 +print b
 +end
 +
 +double:
 +a$ = a$ + a$
 +return
 +
 +triple:
 +b = b * 3
 +return
 +</code>
 +will display\\
 +<code>
 +HelloHello
 +9
 +</code>==== See Also ====
 +[[goto|Goto]], [[Return|Return]]
 +
 +==== Notes ====
 +As of version 0.9.9.2 [[goto|Goto]], [[gosub|Gosub]], and labels can not be used in [[Function|Function]] and [[Subroutine|Subroutine]] definitions.
el/gosub.txt ยท Last modified: 2020/02/28 10:46 (external edit)