RETURN statement and ON . . . RETURN phrase
- Last Updated: January 16, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
In any RETURN statement, whether it returns
an ERROR or not, you can return a text string to
the calling procedure. This string is accessible in the caller through
the RETURN-VALUE built-in function. Thus, a procedure
can use a single RETURN statement to raise the ERROR condition
in the caller, return a message, or both. This is the syntax of
the RETURN statement:
Syntax
|
Likewise, the caller can check for the ERROR-STATUS:ERROR condition,
or a RETURN-VALUE, or both, depending on the agreement between
caller and callee as to how they communicate with one another. The RETURN-VALUE function
retains its value even through multiple RETURN statements.
Thus, while it is not required, it is advisable always to have a RETURN statement at
the end of every procedure, if only to clear the RETURN-VALUE.
A simple RETURN statement is the same as RETURN
"". If you want to pass the RETURN-VALUE up
the call stack, you should do this explicitly using the statement RETURN RETURN-VALUE.
The same is true of the RETURN option as part
of the ON phrase in a block header. It can return
a return-value, raise ERROR, or both.