GOSUB


General Form:

     GOSUB line_number


The GOSUB statement is used to execute a subroutine that begins at the specified line number. The subroutine is terminated with a RETURN statement.

Each time a subroutine is entered an entry is made into the RETURN stack. The stack entry is only removed when a RETURN statement is executed. All RETURN stack entries are removed when a CLEAR, RETURN CLEAR or a LOAD statement is executed. Jumping out of subroutines without executing a RETURN statement may eventually result in an A04 stack overflow error.

The GOSUB 'label statement is to be preferred as it makes programs more readable.

Syntax examples:

GOSUB 1049
IF act_1 <> test_1 THEN GOSUB 2020

See also:

ON ... GOSUB, RETURN, RETURN CLEAR, GOSUB'