Year 4 - Lesson 3
(I Can Count)

Learning Intention
- I can use a variable to make Ohbot count
Introduction
Explain that we are going to make Ohbot count. For this we are going to be creating a program that uses a variable.
You might want to discuss the use of a variable to keep and alter a score in a computer game. BBC Bitesize also has a handy explanation here http://www.bbc.co.uk/guides/zw3dwmn.
Explain that we are going to make Ohbot count. For this we are going to be creating a program that uses a variable.
You might want to discuss the use of a variable to keep and alter a score in a computer game. BBC Bitesize also has a handy explanation here http://www.bbc.co.uk/guides/zw3dwmn.

Teacher Input 1
First, we will use Make a Variable from the Data palette to create a variable called ‘Count’. Make sure there is a tick in the box next to count, this will display the value of the variable at the top left of the code area.
First, we will use Make a Variable from the Data palette to create a variable called ‘Count’. Make sure there is a tick in the box next to count, this will display the value of the variable at the top left of the code area.

To start with we need to set the value of the variable. We can start our program with a when green flag clicked instruction. First, we need a set Count to 0 instruction. This means we will start counting at zero. Next, we need to make a loop where we continually increase the value of ‘count’ by 1. We do this using a forever instruction and a change Count by instruction with the value set to 1. We now need to test our code by clicking the green flag. Once successful, we can File, Save As - ‘count in ones’. We can now use our first variable program as a skeleton to make other counting programs using a variable.

Activities
1. Can you write some code to make Ohbot count in twos?
2. Can you write some code to make Ohbot count in fives?
3. Can you write some code to make Ohbot count in tens?
4. Can you write some code to make Ohbot count in a 3 digit number?
5. Can you write some code to make Ohbot count in a 4 digit number?
1. Can you write some code to make Ohbot count in twos?
2. Can you write some code to make Ohbot count in fives?
3. Can you write some code to make Ohbot count in tens?
4. Can you write some code to make Ohbot count in a 3 digit number?
5. Can you write some code to make Ohbot count in a 4 digit number?
Extension
1. Can you change the number that Ohbot starts counting from? Can you make Ohbot count in ones starting from 20?
1. Can you change the number that Ohbot starts counting from? Can you make Ohbot count in ones starting from 20?

If Ohbot wants to start counting from 20, which part of the code do you think we have to change? (set Count to). Remember to set the tick next to ‘Count’ on the Data palette so you can watch the counting in the display. Save the project - File, Save As - ‘count from 20’. We can now use this knowledge to complete other counting tasks?

Extension Activities
2. Can you make Ohbot count in twos starting from 30?
3. Can you make Ohbot count in fives starting from 25?
4. Can you make Ohbot count in tens starting from 100?
5. Can you make Ohbot count in 125’s starting from 1000?
2. Can you make Ohbot count in twos starting from 30?
3. Can you make Ohbot count in fives starting from 25?
4. Can you make Ohbot count in tens starting from 100?
5. Can you make Ohbot count in 125’s starting from 1000?
Plenary
Encourage children to share their programs with the class and discuss ones that don’t work, work partially or have used a different algorithm to reach the same outcome. Encourage children to talk through how they work block by block and work as a class to debug a program to improve it.
Encourage children to share their programs with the class and discuss ones that don’t work, work partially or have used a different algorithm to reach the same outcome. Encourage children to talk through how they work block by block and work as a class to debug a program to improve it.