Skip to main content

Loop Overview

Remember the following points:

  • Decide what controls the loop, ie: which variable
  • The While line is put in AFTER the loop control variable is initialised. In the CarHireSystem program it is the variable StartMiles that controls the loop.
  • The While statement is followed by a Begin. This begin is highlighted by a comment in brackets, ie: { }.
  • The control variable, ie: StartMiles, must be input again just before you exit the loop. The While statement has an End. This end should be highlighted by a comment in brackets.

Next: Problem Solving Tasks for Loops