|Home | Tutorial | Classes | Functions | QSA Workbench | Language | Qt API | QSA Articles | Qt Script for Applications | ![]() |
[Prev: default] [Home] [Next: else]
do { Statements; } while ( condition );
This keyword is used in conjunction with while to form a loop which is guaranteed to execute at least once.
The Statements in the braces following the do are executed once. If the while condition evaluates to true, execution passes back to the do, and the whole process repeats. If the while loop's conditional ever becomes false, execution continues from the statement following the while statement.
Example:
var x = 0; do { x += 5; if ( x == 50 ) continue; System.println( x ); } while ( x < 100 );
The example prints 5, 10, 15, ..., 45, 55, 60, 65, ..., 95 on the console.
See also while, for, continue and break.
[Prev: default] [Home] [Next: else]
Copyright © 2001-2006 Trolltech | Trademarks | QSA version 1.1.5
|