RETURN Instruction |
RETURN
RETURN returns control from a PROCEDURE or FUNCTION. For a procedure, execution continues with the instruction following the EXECUTE that invoked the procedure. For a FUNCTION, the calculation in which the function was invoked is continued.
RATS automatically puts a return at the end of a PROCEDURE or FUNCTION, so you only need RETURN if you want to exit before hitting the end of the subprogram.
Before you return from a FUNCTION, you should set the return value by assigning it to the function’s name.
Example
procedure regdiags resids
type series resids
*
option arch integer 0
option qstat integer 0
*
local series ressqr
*
if arch<0
{
display "REGDIAGS: ARCH option must be >=0"
return
}
if arch>0
...
uses RETURN to abort the procedure if the user specifies an improper value for an option.
Copyright © 2026 Thomas A. Doan