Implemented in | Navigator 2.0 |
while (condition) {
statements
}
while
loop iterates as long as n
is less than three.n = 0Each iteration, the loop increments
x = 0
while(n < 3) {
n ++
x += n
}
n
and adds it to x
. Therefore, x
and n
take on the following values:n < 3
is no longer true, so the loop terminates.Last Updated: 10/31/97 12:29:59