Return

Use

Transfers the execution pointer to the exit point of the current procedure and allows a return value to be set.

Command Syntax

RETURN [expression]

where:

expression
Can be any expression that may occur in the source language program, including references to simple as well as aggregate (such as array, record, and structure elements) type variables

Description

The RETURN command transfers the current execution pointer to the exit point (%EXIT) of the current procedure. If the procedure returns a value, an expression indicating the return value must be given. An expression should not be given if the procedure does not return a value.

If the current execution point is already at the exit point of the current procedure, no action is taken if the procedure does not return a value, or the return value is set to the given expression if the procedure does return a value.

Example

In this example, the return value of the ISPRIME routine is set to "15".

CodeWatch> RETURN 15
CodeWatch> LRETURN
Return value for PRIMES.ISPRIME is 15 {fixed binary(31)}