Return function

Syntax

Return [expression]

Description

Use the Return function to return from the currently active function or method; the flow of execution continues from the point where the function was called.

If the function or method returns a result, that is, if a return value is specified in the Returns clause of the function or method definition, expression specifies the value to pass back to the caller and must be included. If the function or method does not return a result, the expression is not allowed. If Return appears in a main program, it acts the same as the Exit function.

Example

In the example a Boolean return value is specified in the Returns clause of the Function statement. The Return statement returns a True or False value to the calling routine, based on the contents of &UPDATEOK.

Function run_status_upd(&PROCESS_INSTANCE, &RUN_STATUS) Returns Boolean;
   &UPDATEOK = SQLExec( )("update PS_PRCS_RQST set run_status = :1  where process_instance = :2", &RUN_STATUS, &PROCESS_INSTANCE);
   If &UPDATEOK Then
      Return True;
   Else
      Return False;
   End-If;
End-Function;