# RETURN

Updated: 11/30/2021, 7:00:45 PM
Created: 11/30/2021, 7:00:45 PM
Last Updated By: Jake Tuttle
Read Time: 1 minute(s)

# Description

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:

RETURN {TO label}
1

or

RETURN(expression)
1

Where:

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.

# Note

  • 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

Go back to Programmers' Reference Guide