C gives you a choice of three types of loop, while, do while and for.
- The while loop keeps repeating an action until an associated test returns false. This is
useful where the programmer does not know in advance how many times the loop will be
traversed.
- The do while loops is similar, but the test occurs after the loop body is executed. This
ensures that the loop body is run at least once.
- The for loop is frequently used, usually where the loop will be traversed a fixed number
of times. It is very flexible, and novice programmers should take care not to abuse the
power it offers.
Go to The Switch Statement Go to Index
Go to The while loop