You are here

Iteration (Repetition) Control Structures

19 January, 2016 - 11:41

Example 10.14: pseudocode: While

count assigned zeroWhile count  < 5  Display "I love computers!"  Increment countEndwhile
media/image27.png
Figure 10.16 While control structure  

Example 10.15: pseudocode: For

For x starts at 0, x  < 5, increment x  Display "Are we having fun?"Endfor

The for loop does not have a standard fowcharting method and you will find it done in different ways. The for loop as a counting loop can be fowcharted similar to the while loop as a counting loop.

media/image28.png
Figure 10.17 For control structure  

Example 10.16: pseudocode: Do While

count assigned five
Do  Display "Blast off is soon!"  Decrement countWhile count > zero
media/image29.png
Figure 10.18 Do While control structure  

Example 10.17: pseudocode: Repeat Until

count assigned fiveRepeat  Display "Blast off is soon!"  Decrement countUntil count  < one
media/image30.png
Figure 10.19 Repeat Until control structure