3. Scratch – Iteration

What is Iteration:

Iteration is used in programming when a set of instructions are to be repeated. Sometimes this is called a loop.


Count Controlled Iteration:

Iteration in Scratch is when we repeat(loop) a block of code.​

Count controlled iteration is used when theprogrammer (or at least the computer) knowshow many times the code needs to repeat.​

In the example below, we arerepeating the ‘say’ blocks 10 times.​


Condition Controlled Iteration:

There is another type of loop called Condition Controlled Iteration.
This makes use of While Loops.
These repeat only whilst a given condition is true.

We will look at this when we study Python later in the year.


Scratch Iteration Example:

It is even possible to see how many times the loophas gone around by introducing a ‘counter’ variable.​

The counter can then be changed (increased) by 1each time the loop repeats.


Scratch Iteration – More Examples: