Sambar Server Documentation
|
CScript For Loops |
for ( initialization; expression; increment )
statement
initialization;
while ( expression ) {
statement increment;
}
The three elements that comprise the for loop construct usually do just one thing each, however any of them can be left blank. A blank first or last statement will mean no initialization or running increment. A blank comparison statement will always be treated as true. This will cause the loop to run indefinitely unless interrupted by some other means. This might be a return or a break statement.
It is also possible to execute multiple statements into a first or
third statement block, separating them with commas. This allows a loop
to have more than one controlling variable. The example below illustrates
the definition of such a loop, with variables hi and lo
starting at 100 and 0 respectively and converging.
for (hi = 100, lo = 0; hi >= lo; hi--, lo++)
© 2001 Sambar Technologies. All rights reserved. Terms of Use.