Skip to content

Procedure_Return

See Also: End_Procedure, Function_Return, Procedure

Purpose

To return execution from a procedure.

Some existing DataFlex procedures return values. This technique is now discouraged. You should not create any new procedures that return values; use functions for this purpose.

Syntax

Procedure_Return

or, legacy syntax

Procedure_Return [ {returnValue} ]

What It Does

The Procedure_Return command is used to terminate a procedure. This command is optional and is only needed if you wish to return from a procedure before the End_Procedure command is encountered.

Example

Procedure RunLoop integer iCounter
    Integer iCount
    String sName
    For iCount from 1 to iCounter
        Get TheName to sName
        // if we run out of names…end the procedure
        If (sName = "") Procedure_Return
        Send ShowTheName sName
    Loop
    // if the loop is completed, End_Procedure will terminate the procedure call.
End_Procedure

Notes

  • There may be as many Procedure_Return commands as necessary in the body of the procedure.

  • Some procedures return values. If a procedure returns a value, the return value is passed as a parameter of this command. returnValue can be a constant, variable, or expression.