While and Do While Loops |
A while loop is similiar to a for loop but better suited for multiple loops. In a while loop, something inside the loop triggers the loop to stop.
|
||||||||||
|
||||||||||
There are two kinds of while loops:
the standard while loop
A while loop doesn't use a counter variable. The control expression in a while loop can be any valid expression. |
||||||||||
the do while loop
Because the control expression is tested at the end of the loop, a do while loop is executed at least one time. |
A do while loop repeats the expression at the begining of the loop. The != symbol shows an inequality. |