The RETURN statement transfers program execution to the caller of a subroutine/function or to a specific label in the program. It takes the general form:
label must reference an existing label within the source of the program.
expression evaluates to the value that is returned by a user-written function.
- The RETURN statement will transfer program execution to the statement after the GOSUB that called the current internal subroutine.
- If the RETURN statement is executed in an external SUBROUTINE and there are no outstanding GOSUBs, then the program will transfer execution back to the program that called it via CALL.
- The program will enter the debugger with an appropriate message should a RETURN be executed with no GOSUB or CALL outstanding.
The second form of the RETURN statement is used to return a value from a user-written function. This form can only be used in a user-written function.
Go back to jBASE BASIC.