- Statements that can return a value
- Other statements used to exit from a loop or from a procedure
- Types returned
- Multiple return values
RESULT statement In french: Renvoyer
RESULT is used to exit from the current process (or procedure) and to return a status report. This status report can correspond to: The RESULT statement can be used in: - The closing code of project,
- The closing code of window or page,
Versions 19 and laterThe closing code of report, New in version 19The closing code of report, The closing code of report,- A procedure (conditional test, FOR, FOR EACH, LOOP or WHILE loop, ...).
Versions 16 and later New in version 16 Versions 18 and later New in version 18
// Call to a procedure that returns NOTHING if a problem occurs // Different process according to the return value Control_Value is string Control_Value = MyProcess(Control_Name) IF Control_Value = "Nothing" THEN Info("No value was calculated") ELSE Info("Value of control: " + Control_Value) END
// -- MyProcess procedure PROCEDURE MyProcess(Control) IF Control..Type = typInputText THEN RESULT Control..Value ELSE RESULT "Nothing" END
Syntax
Procedure Hide the details
PROCEDURE <Procedure name> ([<Parameter>]) IF <Condition> THEN RESULT <Value(s) to Return> ELSE RESULT <Value(s) to Return> END
Remarks: - The following operations are performed if <Condition> is fulfilled:
- Return a status report to the calling process. The type and value of <Value to return> depend on the value expected by the process calling the procedure.
- Exit from the statement block.
- Exit from the current process (or procedure).
Versions 19 and laterYou have the ability to return several values. See Multiple return values for more details. You have the ability to return several values. See Multiple return values for more details.
Code for closing the window, the page or the report Hide the details
RESULT <Value to return>
Remarks: - In this case, <Value to return> must correspond to the expected value during the call to the window, page or report.
Versions 19 and laterYou have the ability to return several values. See Multiple return values for more details. You have the ability to return several values. See Multiple return values for more details.
Remark: In this case, <Value to return> must be an integer. This value can be retrieved by any application. For a WINDEV application, the value returned by another application can be retrieved by ExeRun. Remarks Statements that can return a value Several statements can return a value in a procedure: - IF statement
PROCEDURE <Procedure name> ([<Parameter>]) IF <Condition> THEN RESULT <Value to return> ELSE RESULT <Value to return> END
- FOR statement
PROCEDURE <Procedure name> ([<Parameter>]) FOR <Control variable> = <Initial value> TO <Final value> [STEP <x>] IF <Condition> THEN RESULT <Value to return> END
- FOR EACH statement
PROCEDURE <Procedure name> ([<Parameter>]) FOR EACH <File> ON <Key item> ... IF <Condition> THEN RESULT <Value to return> END
- LOOP statement
PROCEDURE <Procedure name> ([<Parameter>]) LOOP ... IF <Condition> THEN RESULT <Value to return> ... END
- WHILE statement
PROCEDURE <Procedure name> ([<Parameter>]) WHILE <Condition 1> ... IF <Condition> THEN RESULT <Value to return> ... END
Versions 19 and laterRemark: These statements can also return several values. See Multiple return values for more details. New in version 19Remark: These statements can also return several values. See Multiple return values for more details. Remark: These statements can also return several values. See Multiple return values for more details.Other statements used to exit from a loop or from a procedure Several statements are available: - RETURN: Exit from the loop and exit from the current process (or procedure).
- BREAK: Exit from the loop and run the rest of the current process (or procedure).
Close is used to exit from the loop (or procedure) and to close the current window. Caution: RETURN and RESULT cannot be used in the same process. Types returned Versions 15 and laterFrom version 15, the following types can be used: - structure
- dynamic structure
- class
- advanced type
- array
- associative array
- queue
- stack
- list
New in version 15From version 15, the following types can be used: - structure
- dynamic structure
- class
- advanced type
- array
- associative array
- queue
- stack
- list
From version 15, the following types can be used:- structure
- dynamic structure
- class
- advanced type
- array
- associative array
- queue
- stack
- list
Versions 19 and later New in version 19
This page is also available for…
|
|
|
| |
| | Remember: If you do a RESULT = "" (Equal sign) by a mistake it will not return from your function, but continue. |
|
|
|
| |
| |
| |
| |
| |
| |
| | |
|