There are two ways in which programs can iterate or ‘loop’:
- count-controlled loops (for loops)
- condition-controlled loops (while or repeat loops)
We are going to look at while loops.
If it does then try the tasks below.
- Change the value of n and the calculation of n (n = n - 1) so that your output looks like the examples below:
Example 1
Now try the harder exercises where we are counting up?
Extension
Example 2
0
1
3
6
I am counting up
10
>>>
Example 3
3
7
12
18
25
I am counting up
33
>>>
Click on the bitesize button to learn all about loops.
Complete the Bitesize test at the end when you have finished.