|
|
CFSCRIPT: While Loop
| 9 |
While Loop (Loop) |
| 9.1 |
A While loop will take a comparison statement and as long as the statement returns true, the loop will run. |
| 9.2 |
The comparison statement used in a While loop uses the same comparison logic and structure used in an IF statement. |
| 9.3 |
This example will loop while i is less than 10. It has the same effect as the For loop example discussed earlier
<CFSCRIPT>
i=1;
while (i LTE 10)
{
WriteOutput(i&' ');
i=i+1;
}
</CFSCRIPT>
|
|
| 9.4 |
The examination of the condition takes place at the beginning of the loop. If the comparison statement fails, the loop will not operate.
|
|
CFScript
|
|