Return

Return ends a script called by Gosub and resumes the execution to the instruction that follows the Gosub.

Syntax

 Return

Examples

# Call several labels by Gosub. These labels have a common return.$ TEST_GOSUBLocal Integer IGosub INCREMENTGosub INCREMENT_TWICEGosub INCREMENT_THREE_TIMES# Here, the value of I is 6Return$INCREMENT_THREE_TIMES : I+=1$INCREMENT_TWICE: I+=1$INCREMENT: I+=1Return

Description

Return returns the execution to the statement that follows the Gosub statement, as indicated by the following schema:

Execution orderInstruction
1Gosub MY_LABEL
2$MY_LABEL
3... instructions following MY_LABEL
4Return
5... instructions after Gosub
6End

Comments

A script called by Call, fmet, or func cannot end by a Return but only by an End statement.

Associated errors

Execution orderInstruction
32Return encountered without preliminary Gosub.

See also

Gosub, Call, func, fmet, Subprog, Funprog.