While-Statement

The while-statement tests the expression in parenthesis, and executes the statements enclosed within braces until the expression is false. The expression must evaluate to a scalar-expression. If the expression evaluates to a vector or matrix a run-time error will result.



while ( expression )
{
statements
}

> while ( 0 ) { "TRUE" }
> i = 0;
> while ( i < 2 ) { i = i + 1 }
 i =
        1
 i =
        2