| for |
|
grammar |
| |
A loop construct that has three optional expressions as part of its
construct that permit, respectively,
initial evaluation, continuance evaluation and iteration evaluation.
The initial expression is evaluated once before
the loop statement is processed;
the continuance expression is evaluated before each time the loop statement
is to be processed;
the iteration expression is evaluated after each time the loop statement is
processed.
If the continuance expression evaluates to a zero value, loop processing
terminates.
Naturally, either
break
or
continue
statements can be used in the body of the loop to further control
execution flow.
Its usage description can be summarized as follows:
Statement:
for ( ExpressionOPT ; ExpressionOPT ; ExpressionOPT ) Statement
| |
| Example: |
In the following example, the
for
loop is used to iterate over an array of available fonts.
import yoix.awt.*;
import yoix.stdio.*;
int i;
Array fl = getFontList();
puts("Available fonts are:");
for(i = 0; i < fl@length; i++) {
printf("\t%s\n", fl[i]);
}
The text on standard output might look like:
Available fonts are:
Dialog
SansSerif
Serif
Monospaced
DialogInput
| | |
| See Also: |
break,
continue,
do,
reference,
while
|
|
Yoix is a registered trademark of AT&T Inc.
|