Syntax

GOSUB label

Meaning

Execution continues with the instruction at label. A label is a number at the beginning of a line. Labels must be unique but can be assigned in any order. Labels and the accompanying program code always come after the last END instruction. A block of code belonging to a label continues until the next label or until the end of the program text (if no other labels occur). ADAPL will store the location of the GOSUB instruction in memory so it can continue with the next line if there is a RETURN instruction in the program text somewhere after the label. The program text between a label and the RETURN instruction is referred to as a subroutine. From a subroutine you can call another subroutine. After a RETURN, ADAPL always goes back to the line following the last encountered GOSUB.

See also

RETURN