| do |
|
grammar |
| |
Marks the start of a looping block whose looping condition,
expressed in a
while
statement, comes at the end of the loop-block and is not tested until
after the first execution of the block occurs.
Naturally, either
break
or
continue
statements can be used in the body of the loop-block to further control
execution flow.
Its usage description can be summarized as follows:
Statement:
do Statement while ( Expression ) ;
| |
| Example: |
In the following example, the
do
loop is used to provide a uniquely named temporary file that is ready
for writing.
import yoix.stdio.*;
File fl;
fl.mode = yoix.io.WRITE;
do {
fl.name = tmpnam(null);
fl.open = true;
} while(!fl.open);
if(fl.open) {
printf("File '%s' is ready for writing.\n", fl.fullname);
fl.open = false;
yoix.system.unlink(fl.fullname);
} else {
printf("Could not open a temporary file for writing.\n");
}
The text on standard output might look like:
File '/tmp/aaaa4Zxmc' is ready for writing.
| | |
| See Also: |
break,
continue,
for,
reference,
while
|
|
Yoix is a registered trademark of AT&T Inc.
|