Chapter 25
Pre-Test, Mid-Test and Post-Test Loop Structures
25.1 The Pre-Test Loop Structure
The pre-test loop structure is shown in the following flowchart.
Let's see what happens when the flow of execution reaches a pre-test loop structure. If Boolean_Expression evaluates to true, the statement or block of statements of the structure is executed and the flow of execution goes back to check Boolean_Expression once more. If Boolean_Expression evaluates to true again, the process repeats. The iterations stop when Boolean_Expression, at some point, evaluates to false and the flow of execution exits the loop.
The Decision symbol (the diamond, or rhombus) is used both in decision control structures and in loop control structures. However, in loop control structures, one of the diamond's exits always has an upward direction.
A “pre-test loop structure” is named this way because first the Boolean expression is evaluated, and afterwards the statement or block of statements...