Skip to content

    Variable Valley

    Year 2 Variables

    Store a score in a variable, change it step by step, and work out its value at the end.

    • Ages 6–8
    • 3 quests
    • Beginner → Getting stronger → Challenge

    A variable is a labelled box that stores a value, like a score or a number of lives. Programs can set a variable and change it as the program runs. Year 2 coders trace short programs to find a variable’s final value.

    What your child will learn

    • Know that a variable stores a value with a name
    • Follow “set” and “change” blocks step by step
    • Work out the final value of a variable

    Keeping score

    Every game with a score uses a variable. “Set score to 0” starts it; “change score by 1” adds one each time you collect a star. Working through a program one line at a time — tracing it — is how programmers check what a variable will be.

    Example questions

    Here are a few questions like the ones in the first quest. Can you solve them?

    1. 1. What is coins at the end?

      Show answer

      Answer: 1. coins starts at 4. 4 − 3 = 1. So coins ends at 1.

    2. 2. What is coins at the end?

      • 1
      • 2
      • 3
      • 0
      Show answer

      Answer: 0. coins starts at 3. 3 − 3 = 0. So coins ends at 0.

    3. 3. What is coins at the end?

      Show answer

      Answer: 5. coins starts at 0. 0 + 5 = 5. So coins ends at 5.

    Tips for grown-ups

    • Keep score in a board game on paper and talk about “changing score by 2”.
    • Use a box labelled “sweets” and add or take away while counting.