As we have seen in many previous examples involving iteration, the three key components of a loop are as follows:
Loop condition— When evaluated to true, will cause the loop body to be repeated.
Loop initialization— During the loop initialization the variable(s) taking part in the loop condition are assigned initial suitable values. This process only takes place once before the loop commences.
Loop update— Updates the variables of the loop condition. This is repeatedly done during every loop.
These are exemplified in Figure 9.6, which uses the source code of the while loop shown earlier. Notice that only the loop condition is restrained by the rules of syntax to a specific position, namely inside a pair of parentheses positioned ...