Caché MultiValue Basic Reference
RETURN
[Back] [Next]
   
Server:docs1
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Returns from a subroutine or function.
Synopsis
RETURN[(retval)] [TO label]
Arguments
retval Optional (Functions Only) — An expression that evaluates to the return value for a user-defined function. The return value must be enclosed in parentheses. If not specified, an empty string is returned.
TO label Optional (Subroutines Only) — Any valid label. The label name can be optionally followed by a colon (:)
Description
The RETURN statement is used to end execution of a user-defined subroutine or function and return control to the statement that invoked the subroutine or function.
Subroutines
The RETURN statement with no argument ceases execution of a subroutine and returns control to the GOSUB statement (for an internal subroutine) or the CALL statement (for an external subroutine) that invoked the subroutine. Program execution resumes with the line immediately following the GOSUB or CALL.
You can terminate an external subroutine with a RETURN or with an END statement.
The RETURN statement with a TO label clause ceases execution of a subroutine and transfers execution to the internal subroutine identified by the specified label.
Functions
The RETURN statement ceases execution of a function and returns retval to the location where the function was invoked. If no retval is specified, an empty string is returned.
Before invoking a user-defined external function, it is necessary to locally define the function using the DEFFUN statement.
See Also