RETURN
 
Syntax


RETURN

inside function-
  RETURN  expression | string-expression

Description


RETURN is used to return control back to the statement immediately following a previous GOSUB call. When used in combination with GOSUB, A GOSUB call must always have a matching RETURN statement, to avoid stack

If the RETURN is inside a function, an integer, single or string expression is expected.

RETURN will exit a FUNCTION or SUB even when inside a component statement such as WHILE, FOR, SELECT ...

If a RETURN is executed without a corresponding GOSUB or CALL, a Prefetch Abort error will stop your program.

Example

PRINT "Let's Gosub!"
GOSUB MyGosub
PRINT "Back from Gosub!"
END

MyGosub:
PRINT "In Gosub!"
RETURN


Differences from other BASICs

See also