SPL to HP C/XL Migration Guide (30231-90001)
6-13
RETURN Statement
Table 6-15. RETURN Statement
---------------------------------------------------------------------------------------------
| | |
| SPL | HP C/XL Equivalent |
| | |
---------------------------------------------------------------------------------------------
| | |
|
return-statement
: | Similar to SPL: |
| | |
| 1. RETURN [
count
] | 1. return ; |
| | |
| 2.
procedure-id
:=
procedure-id-value
| 2a. return
procedure-id-value
; |
| | |
| : | 2b.
return-id
=
procedure-id-value
|
| | |
| RETURN [
count
] | : |
| | |
| | return
return-id
; |
| | |
---------------------------------------------------------------------------------------------
| | |
| Format 1 is a return from a procedure that | Format 1 is equivalent to SPL. |
| does not return a value. | |
| | Format 2 is equivalent to SPL. |
| Format 2 is a return from a function | |
| procedure that returns a value assigned to | Format 2b is a simple way to convert the |
| the
procedure-id
. | SPL code. Simply change the use of the |
| |
procedure-id
inside the procedure to |
| The
count
is the number of words to delete | another, local same-type identifier, here |
| from the stack. | called
return-id
. Then append this |
| |
return-id
to the return statement. |
| | |
| | In any case,
count
must be recoded or |
| | ignored. |
| | |
---------------------------------------------------------------------------------------------
| | |
| RETURN is used to exit from a procedure at | Same as SPL for void functions. |
| a point other than the END of the procedure | |
| body. | Functions used in expressions require a |
| | returned value. The only way to return a |
| | value is with the return statement. |
| | |
| | For functions that return a value, add a |
| | return statement before the final brace. |
| | |
---------------------------------------------------------------------------------------------
See "Data Type" for examples and additional information.