Fixed Loop
A fixed loop will repeat for a set amount of time and allows the code to carry out repetitive lines of code. The number of times a selection of code has to be repeated is normally specified by the programmer.
The For Loop has a loop counter. This counter is an integer and its value will increase by 1 every time a loop has completed.
The code within a loop is indented so show where the loop will begin and end within the program.
Structure Diagram – Loop Example
Conditional Loop
A While Loop (conditional loop) will repeat a selection of code while a condition is false. If that condition is not met, then the selection will repeat until the condition is true.
Structure Diagram – Conditional Loop Example