Trail: PROIV Documentation > Developer > PROIV Developer > Developing Functions > Events and Logic > RETURN
|
|
Purpose
|
RETURN is the last statement executed in a called step, and the last statement in an Alpha or Numeric Global Logic routine.
|
Syntax
|
RETURN
in a Global Logic routine:
RETURN(value)
|
Operation
|
value is the value to be returned to the Local Logic or Special Check routine which called the Global Logic. This must be of the same type as the Global Logic.
|
Remarks
|
RETURN is processed only if it is issued in a called step or Global Logic routine.
here may be more than one RETURN statement in a called step, however, they all cause a return to the same statement.
|
Example
|
Called Step Example
CALL 1
IF A = B THEN CALL 2;
IF J = K THEN EXIT;
CALL X
.
.
.
1 X = 3
RETURN
2 $D = ‘DEF’
3 $E = ‘GHI’
RETURN
Step 1 is called X is set to 3.
RETURN causes control to be returned to the statement following CALL 1.
If the condition A = B is true, Step 2 is called.
$D is set to ‘DEF’.
The logic routine is exited because there is no RETURN statement in step 2.
If the condition A = B is false, the next sequential statement is executed.
If the condition J = K is true, the logic routine is exited.
If the condition J = K is false, the next sequential statement, CALL X, is executed and, as X was set to 3 in Step 1, Step 3 is called.
Step 3 $E is set to GHI.
Control is returned to the statement following the calling statement. The remaining statements in the logic routine, up to but not including Step 1, are processed.
|
|
The practice of omitting a RETURN (as in step 2) is not recommended, since the code is less readable than when a RETURN is specified.
In this example, step 2 can be followed by an EXIT to ensure it ends with a RETURN, without changing the meaning of the overall logic.
|
Comment on this topic
Topic ID: 520105