Loop Exit Conditions

Loop exit conditions determine the number of iterations that a loop executes. For example, fixed indexes in for loops determine the iterations. The loop iterations must be countable; that is, the number of iterations must be expressed as one of the following:

Loops whose exit depends on computation are not countable.

Loop Usage Comparisons

Correct Usage for Countable Loop:

Correct Usage for Countable Loop:

Incorrect Usage for Non-Countable Loop: