X Tables
Scratch Maths

Where is unknowns hiding in Scratch variable monsters?

Introduce algebra as a box that can hold changing numbers.

Quick answer

In Scratch, variables are like invisible boxes that can hold different numbers, and these boxes help us create games and stories where numbers change. The "unknowns" in Scratch are these variable boxes that can hold different values as the program runs.

Learning outcome

By the end of this page, you will understand how variables in Scratch can hold changing numbers, like invisible boxes that store values for your projects. Success signs:
  • You can name a variable in Scratch and see it appear on the screen
  • You can change the value of a variable during a game or story
  • You can use a variable to keep track of points, lives, or scores
  • You can explain how variables help make programs more interesting

Why this matters

Variables in Scratch help you make programs that can change and grow. Just like how you might use a box to hold your toys, variables hold numbers that change as your game or story progresses. When you understand variables, you can make your own games where points go up, lives decrease, or characters move around the screen. This is the first step to understanding more advanced maths and programming concepts later on.

How it works

Variables in Scratch are like special boxes that can hold numbers. When you create a variable, you give it a name like "score" or "lives". You can change the number in that box as your program runs. You can show the variable on the screen so everyone can see it. If you want to add or take away points, you can change the number in the box. Variables make your programs interactive and exciting.

Examples you can see

Let's imagine you are making a game where a character collects coins. You need to keep track of how many coins they have. Here's how it works:
  • First, you create a variable called "coins"
  • Then, you set coins to 0 at the start of the game
  • Each time the character collects a coin, you add 1 to the coins variable
  • Finally, you show the coins variable on the screen so players can see how many they have
Here's another example with a character who has lives:
  • Create a variable called "lives"
  • Set lives to 3 at the start
  • When the character gets hit, subtract 1 from lives
  • When lives reach 0, the game ends

Try it as a mini adventure

Adventure: The Variable Monster Hunt You are a detective in a magical land where numbers come alive. There are monsters that hide unknown numbers in their caves. Your mission is to find these monsters and help them by making variables to keep track of their numbers. 1st time: You find a monster that hides 5 apples in its cave. You make a variable called "apples" and set it to 5. 2nd time: The monster eats 2 apples. You subtract 2 from the apples variable. 3rd time: A friend gives the monster 3 more apples. You add 3 to the apples variable. 4th time: You count all the apples the monster has now. You show the apples variable on the screen. 5th time: The monster wants to share its apples equally with 2 friends. You divide the apples by 3 to find how many each gets. 6th time: You discover that the monster's variable "apples" can change as the game goes on. You make a note that variables can hold different numbers.

Common mistakes

  • Mistake: Forgetting to create a variable before using it.
    Why it happens: The program doesn't know what box to look in.
    Fix: Always create your variables before using them in your code.
  • Mistake: Using the wrong variable name.
    Why it happens: Confusing "score" with "points".
    Fix: Double-check that you're using the exact name you created.
  • Mistake: Not updating the variable when the number changes.
    Why it happens: Thinking the number in the box stays the same.
    Fix: Use the "change variable by" or "set variable to" blocks to update the number.
  • Mistake: Trying to use a variable before it has a value.
    Why it happens: Not setting the starting number.
    Fix: Always set the variable to a number before using it in calculations.

Parent and carer guide

To help your child learn about variables in Scratch:
  • Start by creating a simple game together, like a coin collection game
  • Give your child a name for their variable, like "points" or "lives"
  • Ask them to explain how their variable changes during the game
  • Let them experiment with different numbers to see how variables work
  • Encourage them to make their own variable names that make sense to them
  • Don't worry if they make mistakes - variables are tricky at first!
  • Remember that variables are like boxes that hold changing numbers, not fixed values

Practice questions

  1. What is a variable in Scratch?
  2. Why do we use variables in Scratch programs?
  3. What is the first step when creating a variable?
  4. If you create a variable called "score" and set it to 10, what happens when you add 5 to it?
  5. How do you show a variable on the screen in Scratch?
Answers:
  1. A variable is like a box that can hold different numbers in a Scratch program.
  2. Variables help us make programs that can change and grow, like keeping track of scores or lives.
  3. The first step is to create the variable by giving it a name.
  4. The score would change to 15.
  5. You use the "show variable" block from the variables menu.

FAQ

What is a variable in Scratch?

A variable in Scratch is like an invisible box that can hold a number. You can change the number in the box as your program runs.

Can I use more than one variable in a Scratch program?

Yes! You can create as many variables as you need for your project. For example, you might have variables for "score", "lives", and "level".

Do variables have to be numbers?

Yes, in Scratch variables always hold numbers. You can't store words or pictures in variables.

How do I change a variable in Scratch?

You can change a variable by using blocks like "set variable to" or "change variable by" from the variables menu.

Why are variables important in programming?

Variables make programs interactive and interesting. They allow your program to remember information and change as it runs, just like how your game scores or lives change during play.