Home | Sign in | French EN
  • Code to run
  • Exiting from a WHILE loop
  • Loop without end
  • Running the next iteration
  • Composite condition
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Stored procedures
In a WHILE statement, the expression is evaluated at the beginning of the statement block.
The process loops as long as the condition expression is True. The program will exit from the statement block when the condition is False.
MyList = INIRead("Examples", "", "", INIFile)
Keyword = ExtractString(MyList, nb, CR)
WHILE Keyword <> ""
        nb = nb + 1
        ExplName = INIRead("Projects installed", Keyword, "", INIFile)
        Keyword = ExtractString(MyList, nb + 1, CR)

"WHILE" condition Hide the details

WHILE <Condition>
  <Action if condition is True>
Marks the beginning of statement block.
Condition to check.
<Action if condition is True>:
Action to perform if the condition is True.
Marks the end of statement block.

Loop with exit according to a "WHILE" condition Hide the details

  DO WHILE <Condition>
Marks the beginning of statement block.
Marks the end of statement block. Used to exit from the statement block. The lines of the loop found before this statement are run.

Code to run

The code to run is found between the WHILE statement and the END statement.

Exiting from a WHILE loop

Several statements are available:
  • RETURN: Exit from the WHILE loop and exit from the current process (or procedure).
  • RESULT: Return a status report to the calling process. Exit from the WHILE loop and exit from the current process (or procedure).
  • BREAK: Exit from the WHILE loop and run the rest of the current process.
Close is used to exit from the WHILE loop and to close the current window.
Caution: RETURN and RESULT cannot be used in the same process.

Loop without end

When compiling the project, a WHILE loop without an obvious end (BREAK, RETURN or RESULT statement missing) is signaled by a warning.

Running the next iteration

To directly run the next iteration without ending the code of the next iteration, use the CONTINUE statement:
WHILE <Condition>
IF <Condition> THEN CONTINUE  // Go back to the WHILE keyword

Composite condition

The AND and OR keywords are used to perform logical operations and to create composite conditions.
For example:
WHILE Price < 100 AND ProductType = "AA"
        NumProduct ++       // Number of products whose price is less than
                                                         // 100 and whose type is "AA"

WHILE Price > 100 OR Price < 500
         NumProduct ++  // Number of products whose price is included between €100 and €500
The conditions made of AND and OR are entirely evaluated.
For example:
A1 > 10 AND B1 < 20
Even if the first condition (A1 > 10) is false, the second condition (B1 < 20) will be checked.
Optimizing the evaluation of composite conditions: Use the _AND_ and _OR_ keywords. If the first condition is false (A1 > 10 in our example), the second condition (B1 < 20 in our example) will not be checked.
Minimum version required
  • Version 9
This page is also available for…
Exemplo While
Exemplo While

_contador is int=0
WHILE _contador <200


//Blog com Video e Exemplo



De matos
10 Oct. 2016