Defining Logic > Statements > Return

Return

When used in logic that is not inside a subroutine, the RETURN statement functions like a very powerful BREAK LOOP statement. Whereas BREAK LOOP exits only the innermost loop, RETURN exits the logic completely, no matter how deeply nested inside loops and statement blocks. Though RETURN can be used in any logic, it is used most often in user-defined subroutines.

 

Note: the capability of the RETURN statement to return a value from a subroutine is a feature available only in the Professional edition of Process Simulator.

 

When used inside a subroutine, the RETURN statement sends a value from the subroutine to the logic that called the subroutine. In the same way that parameters send information from the calling logic to the subroutine, RETURN sends information from the subroutine to the calling logic. After the RETURN statement is executed, execution of the subroutine is terminated.

 

When a subroutines returns a value, the RETURN statement must be followed by some expression, which determines the value to be returned by the subroutine. If a subroutine is called by an ACTIVATE statement, then the return value is ignored by the calling logic.

 

The following are examples of RETURN statements:


© 2016 ProModel Corporation • 556 East Technology Avenue • Orem, UT 84097 • Support: 888-776-6633 • www.promodel.com