Control Structures

return

Supported By

Syntax

return expression

Description

The return statement ends execution of the handler and sets the return value of the message or function call.

When it appears within a message handler (on structure), the return statement places the value of expression into the built-in function result. The value of the result function is valid only immediately after a command executes; each new statement resets the result.

When it appears within a function handler (function structure), the return statement dictates the returned value of the function. The returned value replaces the function in the calling statement.

Note

User-defined functions are always followed by parentheses. Unlike built-in functions, user-defined functions cannot be called with the, of, or in.

See Also

on, function