RTN

Terminates execution of an external Proc subroutine and transfers control to the Proc that called the subroutine via the [ ] statement.

Syntax

RTN {n}

Syntax Elements

n specifies that control will be returned to the nth statement after the [ ] command.

Operation

The RTN command terminates execution of an external Proc subroutine and transfers control to the Proc that executed the called subroutine via the [ ] command. Execution continues with the statement following the [ ] command.

If the optional n is used, control returns to the n'th statement after the [ ] command. If n is not specified, the default value is 1.

Note

If a Proc called with the [ ] command does not execute a RTN statement, it will not return to the calling Proc, but will terminate.

If a Proc containing a RTN statement is run from TCL, when the RTN statement is encountered it exits to TCL.

Example

.
.
.
IF %1 = ABC RTN
OERROR!
IP?%1
.
.
.
RTN

In this example, if the 1st parameter in the primary input buffer is ABC, then control returns to the calling Proc; otherwise, ERROR is printed and the prompt is redisplayed.