## Year 4 - Lesson 5

(Two Variables)

**Learning Intention**

- I can work with two variables

What did we learn to do last week? (We learnt how to use a

We will be creating some new variables to count Ohbot’s movements. This will link up with the movement tasks we completed in Year 3 and all the work we have covered on the variable ‘Count’ in Year 4.

**Introduction**What did we learn to do last week? (We learnt how to use a

**instruction to speak the variable ‘Count’ and we completed some additional counting challenges using variables.) Today we are going to continue with our work on variables. What is a variable?***say*We will be creating some new variables to count Ohbot’s movements. This will link up with the movement tasks we completed in Year 3 and all the work we have covered on the variable ‘Count’ in Year 4.

We are now going to use

If we use a

**Teacher Input 1**We are now going to use

**to create a variable called ‘***Make a Variable**head nod’.*This variable will be used to count the number of times Ohbot moves its head up and down in a task. Remember to have the tick next to ‘head nod’ on the**palette to watch the counting.***Data*If we use a

**instruction with a count of 2, how many times will Ohbot nod? (2). Therefore, the “***repeat**head nod*” count will go up to two. If we use a count of 10, how many times will Ohbot nod? (10). Therefore, the*“head nod”*count will go up to 10.

1. Can you write some code to make Ohbot count the number of times it nods his head? You can explore the code by changing the number of repeats.

**Activities**1. Can you write some code to make Ohbot count the number of times it nods his head? You can explore the code by changing the number of repeats.

**,***File***Save As**– ‘count head nod’.2. Can you write some code to make Ohbot count the number of times it blinks?

File, Save As – ‘count blink’.

File, Save As – ‘count blink’.

Can you make three variables for Ohbot’s keep fit routine? Can you write a script to make Ohbot count the number of times it nods his head, shakes its head and looks up and down with its eyes?

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.

**Extension**Can you make three variables for Ohbot’s keep fit routine? Can you write a script to make Ohbot count the number of times it nods his head, shakes its head and looks up and down with its eyes?

**,***File***– ‘count keep fit’.***Save As***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.