The RETURN command causes the program context to revert to the next-higher program level. RETURN can be called at the interactive command prompt (see ), inside a procedure definition, or inside a function definition.
Calling RETURN from the main program level has no effect other than to print an informational message in the command log.
Calling RETURN inside a procedure definition returns control to the calling routine, or to the main level. Since the END statement in a procedure definition also returns control to the calling routine, it is only necessary to use RETURN in a procedure definition if you wish control to revert to the calling routine before the procedure reaches its END statement.
In a function definition, RETURN serves to define the value passed out of the function. Only a single value can be returned from a function.
If the input argument is non-zero, the routine prints the value and exits back to the calling procedure or main level. If the input argument is zero, control proceeds until the END statement is reached.