User Guide > Scripting > Script Statements > Return Statement
Was this helpful?
Return Statement
 
Description
The Return statement can be used for early termination of the processing and can be optionally used to return a value.
Syntax
Return expr
OR
... Return
Remarks
Return works as if the end of the expression has been reached. Any value left on the stack becomes the return value. If a value is placed in the expr argument, then that value is explicitly returned.
Note:  Returned values from scripts executed in process expression steps are not retained upon script completion. Use variables, macros, external files, etc. to retain values that can be tested in other process steps. See also Decision Step.
Example
The following causes the expression to terminate with the value 25 as the Return value:
...
25
Return
The following causes the expression to terminate with the value 37 as the Return value:
...
Return 37
The following example shows how a return statement can be used to exit early any script or function:
if counter > max then
return
end if

'more statements
Last modified date: 02/09/2024