Friday 4 December 2015

Iteration

Iteration
Simply iteration just means repetition.
It is a sequence of instructions that are repeated multiple times.

There are 3 different types of iteration. These are:

  • WHILE
    • This loop is a condition controlled loop. the condition is tested upon entry to the loop, the instruction in this loop would not be executed if not all of the conditions are met. The loop will repeat itself until all the conditions are met, when this happens the loop will be exited.
  • REPEAT
    • The statements in this loop are executed before the condition is evaluated. A repeat loop is also a condition controlled loop, and it must be run through once at least.
  • FOR
    •  This is a count controlled loop, this is because you tell it the amount of times to complete this loop. For this there will always be a counter variable which will automatically increment each time that the loop is run through.
A procedure is a sub routine which execute their statements and does not return a value.

No comments:

Post a Comment