mk90.basic.statements
Statement GOSUB
Call a numbered subroutine.
Syntax
GOSUB line-numberParameters
| Parameter | Meaning |
|---|---|
line-number | Literal destination present in the source. |
Behavior
Pushes a return frame and jumps to the target. RETURN resumes at the following instruction, which may be after a colon on the caller’s line.
GOSUB and FOR share eight last-in, first-out control frames. Calls can nest within that combined limit. Variables are global; there are no parameters or automatic local variables.
Example
10 A=4
20 GOSUB 50
30 PRINT A
40 END
50 A=A+1
60 RETURNLimits and diagnostics
No named subroutines or functions defined by the program. Finish nested FOR frames before returning from a subroutine.
See also
RETURN · FOR · Language syntax