11.9 Return statement

Return [(<retval1>, <retval2>, ...)]

The Return statement is used to exit from a user defined function. The program control will return to the position in the script from where the function was called.

Optionally, Return can return as many values as you like back to the caller. If you return values from a function, it is obligatory to put these values into parentheses. For example:

; wrong!
Function p_Min(a, b)
    If a < b Then Return a
    Return b

; right!
Function p_Min(a, b)
    If a < b Then Return(a)

See Functions for details.

Compatibility note: Return can also be used after a Label statement so that this label code can be called by Gosub. This feature is only included for compatibility with Hollywood 1.x scripts. Please do not use it any longer.

Show TOC