Thus, the minimum number of times the while loop is executed is
zero. Please understand that since the condition is tested before entering the body of the loop, it
is also known as pretested loop or a top-tested loop. Also understand that when the
boolExpr
always returns a true value, the loop becomes an
infinite loop. For example,
while (true) {
Stmt;
}
This is an
infinite loop.
Here, the Boolean literal true is used in place of a boolExpr. It may also
be written as follows to form an infinite loop:
while (! false) {
Stmt;
}
Thus, if a loop does not have a way of stopping, it is called an infinite loop.
Do'stlaringiz bilan baham: |