A good answer might be:

typedescription
counting loop

Uses a loop control variable to count upwards or downwards (usually by an integer increment.)

sentinel-controlled loop

Loop keeps going until a special value is encountered in the data.

result-controlled loop

Loop keeps going until a test determines that the desired result has been achieved.

Fundamental Loops

Each of these three types of loops can be built using the while and other statements. The loops have to be built out of several of the fundamental statements because there are three things (in each of the three types of loops) that have to be done correctly:

  1. The loop must be initialized correctly.
  2. The ending condition must be tested correcly.
  3. The body of the loop must change the condition that is tested.

Usually each of these three considerations is located in a different spot. No wonder that loops often go wrong! The flow chart to the left shows what all loops must do. The ellipses (. . . .) shows where the loop can do additional computation in its body. Overlooking one of these three aspects usually results in an incorrect loop and a sometimes difficult to find program bug!


QUESTION 2:

Would it be convenient to have all three aspects combined into one statement where they would be hard to overlook?