Error getting tags :
error 404Error getting tags :
error 404 return | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Expander triangle
Control Structure
return value
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
None required
Stops the current handler and returns a value to the handler that called the current handler.

Additional Comments
Expander triangle

Use the return control structure to return a value from a custom function or getProp handler, or to return an error message from a message handler or setProp handler.


The return statement appears on a line by itself, anywhere inside a handler.


The handler is the name of the handler in which the return control structure appears.


When the return control structure is executed, any remaining statements in the handler are skipped. Hence, the return control structure is usually used either at the end of a handler or within an if control structure.

If the return control structure is within a function or getProp control structure, the value is returned to the calling handler as the function value or property setting. For example, if you have the following function handler:

function simpleFunction

return 1

end simpleFunction

which is called in the following statement:

put simpleFunction() into field 1

then 1, the value returned by "simpleFunction", is placed in the field.

If the return control structure is within an on or setProp control structure, the value can be retrieved by checking the result function in the calling handler. Usually, when the return control structure is used within an on or setProp control structure, it returns an error message. (If you want a handler to compute a value as its main reason for existence, you should implement it as a custom function rather than a custom command.)

When a message handler executes a return statement, the message stops and is not passed to the next object in the message path. To halt the current message handler and pass the message on through the message path, use the pass control structure instead. To halt the current handler without returning a result, use the exit control structure instead.

Note: The returncontrol structure is implemented internally as a command and appears in the commandNames.

User Comments
Expander triangle