return

Syntax return (expression)

Action Evaluates expression and exits the current script, with the result of expression being the value of the call that invoked it.

Examples on exponentiate (n, power)
local (i, exp = 1)

for i = 1 to power

exp = exp * n

return (exp)

result = exponentiate (10, 3)
Type this script into a script window. In the last line of "exponentiate", the local variable "exp" is the expression whose value is returned by the script. In the assignment statement below it, the call exponentiate (10, 3) evaluates to 1000 - the value
of "exp" when it is used in the return statement. Thus, the value 1000 is assigned to "result."

Notes The parentheses around the expression being returned are not required, but we recommend their use for improved readability. This is a matter of scripting style and has no effect on the statement's execution.

See Also on

Discuss