The return instruction terminates execution of the method and optionally return the expression value as the result of the method.
Syntax
The syntax of the return instruction is:
return [expression];
Description
When a return instruction includes an expression to be returned, the type of that expression must be compatible with the return type defined in the method signature.
Examples
The following example shows the use of the return instruction to return a
getAllPositions(): StringArray; vars stringArray : StringArray; begin create stringArray transient; stringArray.add ("CEO"); stringArray.add ("Project Manager"); stringArray.add ("Analyst"); stringArray.add ("Analyst Programmer"); stringArray.add ("Programmer"); return stringArray; end;
The following example shows the use of the return instruction with no returned results.
if customerName = null then app.msgBox("A name must be entered", "Error", MsgBox_OK_Only); return; endif;
The following example shows the use of the return instruction to return a
isOpen(): Boolean; begin return closedDate = null; end;