|Home | Tutorial | Classes | Functions | QSA Workbench | Language | Qt API | QSA Articles | Qt Script for Applications |

[Prev: try] [Home] [Next: with]

### while

    while ( condition ) {
        Statements;
    }

This keyword is used to repeat a block of code zero or more times. When the `while` statement is encountered the condition is evaluated. If the condition is `true`, the Statements in the `while` block are executed; otherwise control passes to the statement following the `while` block. If the condition is `true`, after the Statements have been executed, the condition is again evaluated, and the whole process repeats.

Example:

        var i = 10;
        while ( i > 0 ) {
            debug( i );
            i--;
        }

See also do, for, continue and break.

[Prev: try] [Home] [Next: with]