Introduction to variables in Scratch - Barclays Code Playground

Key Stage: Key Stage 2 Coding Language: Scratch  Resource type: Lesson plan and teacher guide

Resource overview

In a program, data values can be constant or variable. If data values are variable they can be changed by the program and the user, for example, when the user is asked a question like their age. Variables may change during program execution.

  • Key resource information

    • You will need: Laptops or desktop computers, access to           
    • Some experience with a block based programming language is helpful, but not essential.
  • Teaching assessment opportunities

    • Have the children try out each other’s code – did they all use the same blocks? 
    • What was different? 
    • What is the benefit of using variables in your programme, instead of keeping score on paper?
  • Lesson length

    • 45 minutes


  • Pupil objectives

    • "I understand what a variable is and can use them in my programming with various outputs”
    • “I understand the operation of a process and its outcome. I can structure related items of information.”
    • “I can compare, describe and show number relationships, using appropriate vocabulary and the symbols for equals, not equal to, less than and greater than.”

Extension activities

Activity book

Magic dinosaur

Ask the magic dinosaur any question to get an answer. Code along as we start to look at how we use list variables in our projects. Using lists is a great way to help make your coding neater and easier to use. Click to watch the video, and for this project you will also need to access

Activity video

Safer Internet Day quiz

For this project we’re creating a fun quiz using list variables, or ‘arrays’ to manage how questions are asked.

Building your curriculum

Any questions?

Code Playground is all about offering the support you need. If you have a question, comment or suggestion, please don’t hesitate to get in touch. We’d love to hear from you.