InstallShield 2015 ยป InstallScript Language Reference
Use the while statement when you want to execute one or more statements repeatedly, as long as a particular condition is true. If the condition is not true when the statement is first executed, the loop is not performed.
To create a while loop:
1. | Set the variable you are using as the condition to an initial state. |
2. | Type the keyword while, followed by the conditional test in parentheses. Do not punctuate this line. |
3. | Build the operation(s) that you want repeated. |
4. | Add the operation that changes the test variable (for example, nCount = nCount + 1, or nCount = SomeVariable). |
5. | End the loop by typing endwhile, followed by a semicolon. |
In the following example, the message box is displayed four times.
nCount = 1;
while (nCount < 5)
MessageBox ("This is still true.", INFORMATION);
nCount = nCount + 1;
endwhile;
Because nCount is assigned an initial value of 1, the while statement evaluates TRUE the first time it is executed; the message box is displayed and nCount is incremented by 1. After the fourth pass through the loop, nCount is equal to 5; the while statement evaluates FALSE and the program continues executing with the statement after endwhile.
Note: You cannot define a label within a while block. You can, however, nest while statements in InstallScript. You must end each while block with endwhile.
See Also
InstallShield 2015 Help LibraryJune 2015 |
Copyright Information | Contact Us |