Ends execution of a program or function, returning control to the calling routine—program or function—or to the Command window.

Syntax

RETURN [<return exp> ]

<return exp>

The value a function returns to the calling routine or the Command window.

Description

Programs and functions return to their callers when there are no more statements to execute. When ended this way, they do not return a value.

Use RETURN in a program or function to return a value, or to return before the end of the program or function.

If the RETURN is inside a TRY block, the corresponding FINALLY block, if any, is executed before returning. If there is a RETURN inside that FINALLY block, whatever it returns is returned instead.