Learning Goals 3 min
By the end of this lesson you will be able to:
- Explain in one sentence why a variable is useful — using the words counter and remembers.
- Make a new variable called score from the orange Variables category in the Blocks Panel.
- Drag the (score) reporter onto the Stage and see it display
0in the top-left corner.
Warm-Up 7 min
Last lesson, you played a market-sounds loop. This lesson kicks off the Catch the Roti Canai arc — and the first thing every catch game needs is a score. You'll meet a brand-new colour in the Blocks Panel — orange Variables — and discover why every game in the world needs them.
Quick-fire puzzle
Aiman wants the cat to count clicks. Each time the green flag is clicked, the cat should say a higher number — 1, then 2, then 3, then 4. He builds this stack. What goes wrong?
when flag clicked
say [1] for (1) seconds
Reveal the answer
The cat always says 1. No matter how many times Aiman clicks the flag — it's still 1. Why? Because the number is hard-coded inside the say block. Scratch has no memory of "how many times have I been clicked".
To count clicks, Scratch needs a little box that remembers a number between clicks. That box is called a variable. Today we make one.
New Concept — variables are boxes that remember a number 15 min
A variable is a tiny box with a name on it. Inside the box, you keep a single number (or word). The box remembers what's inside even after a block finishes running. That's the magic — Scratch finally has a memory.
Think of it like the score sheet at a badminton match. The referee writes the score on a small whiteboard. The number changes every time someone wins a point — but the whiteboard itself stays. Without the whiteboard, after every point you'd have to start counting from zero. The variable is the whiteboard.
The Variables category
Open the Blocks Panel. Scroll down past the green Operators. You'll see an orange dot labelled Variables. Click it. The panel looks almost empty — just one button at the top: Make a Variable. That's because variables are your idea — you name them, you make them. Scratch doesn't guess.
| Block | Category | What it does |
|---|---|---|
| Make a Variable (button) | Variables (orange) | Opens a dialog box. You type a name and click OK. A new variable appears in the panel. |
| (score) reporter | Variables (orange) | A round, oval-shaped block holding the current value of the variable. Drop it on the Stage to show the value. |
The reporter is round — that's a clue
Notice the shape of (score) — it's a round oval. Round means "I'm a number — slot me into any round hole." Anywhere a Scratch block has a round number socket (like move (10) steps or say [Hello!]), you can drop (score) in instead of typing a fixed number.
What you'll see on the Stage
When you make a variable, Scratch automatically shows a small read-out in the top-left corner of the Stage — like a scoreboard. It looks like a tiny orange label that says score and then a number next to it. That's the variable's watcher.
Why it matters
Every game you've ever played has at least one variable — the score, your lives, your level, the timer. Without variables, a game cannot keep track of anything. Today's lesson plants the seed; the next two lessons grow it.
Worked Example — make the score variable 15 min
Open Scratch in a new tab. The cat sits in the middle. We'll make one variable — score — and watch the orange watcher appear on the Stage.
Step 1 — Open the Variables category
In the Blocks Panel, scroll down the round category dots. Find the orange one labelled Variables. Click it. The panel shows just one button — Make a Variable — and nothing else.
Step 2 — Click "Make a Variable"
A small dialog box pops up. It asks: New variable name? with a text field below.
Step 3 — Type the name
Type score in the text field. Below the field, you'll see two radio buttons: For all sprites (selected by default) and For this sprite only. Leave the default — For all sprites. Click OK.
Step 4 — See what just happened
Two things changed:
- The Blocks Panel now shows new orange blocks — including a round (score) reporter at the very top, with a tick-box next to it.
- The Stage now shows a small orange watcher in the top-left corner reading
score 0.
Step 5 — Check the tick-box
Next to (score) in the panel, there's a small tick-box. Tick = watcher visible on Stage. Untick = watcher hidden. Try unticking and re-ticking — the orange label on the Stage appears and disappears.
Step 6 — Use score inside a say block
Build a tiny script to prove the variable works. Drag when ⚑ clicked. Drag say [Hello!] for (2) seconds beneath. Now grab the round (score) reporter from the orange panel and drop it into the [Hello!] socket of the say block. The block changes shape — it now says say (score) for (2) seconds.
when flag clicked
say (score) for (2) seconds
0.Step 7 — Click the green flag
The cat says 0 for 2 seconds. Always 0. Why? Because the box is empty — the default value of any new number variable is 0. To change what the cat says, we need to change what's inside the box. That's the next lesson.
What changed: compared to a project with no variables, your editor now has an extra category full of orange blocks, your Stage has a tiny scoreboard, and your cat can read its value out loud.
Your finished setup
when flag clicked
say (score) for (2) seconds
0.Try It Yourself — three small builds 12 min
Goal: Hide and show the watcher. Untick the box next to (score) in the Blocks Panel. The orange label on the Stage disappears. Tick it again — it returns.
Then run this script:
when flag clicked
say (score) for (2) seconds
Think: Even when the watcher is hidden, the variable still exists. The cat still says 0. Hiding the watcher just hides the display — not the box.
Goal: Make a second variable called lives. Click Make a Variable again, type lives, click OK. Now you have two watchers on the Stage — two boxes, two names, both starting at 0. Build this:
when flag clicked
say (lives) for (2) seconds
Think: Each variable is its own box. The score box and the lives box have no connection. You could have a third — level — and a fourth — coins. Pick names that match what they hold.
Goal: Use (score) inside a different block. Drop the round reporter into the number socket of a move ( ) steps block. Run this:
when flag clicked
move (score) steps
Think: The cat moves 0 steps — it doesn't move at all. Why? Because score is still 0. The round shape of the reporter fits anywhere a round number socket lives. Tomorrow we'll learn how to change the value, and then the cat will actually move.
Mini-Challenge — three watchers, one stage 5 min
"Build a tiny dashboard"
Make three variables for an imaginary catch-the-kuih game: score, lives, and level. Drag all three watchers around the Stage so they line up in the top-left corner like a real game dashboard. Then build a single script that asks the cat to read all three numbers aloud.
It works if:
- Three orange watchers are visible on the Stage:
score,lives,level. - Clicking the flag makes the cat say all three values in a row (each starts at
0). - You only used Variables, Events, and Looks blocks — and the stack is ≤ 8 blocks long.
Reveal one valid solution
After making the three variables, build this 4-block stack. The cat reads each watcher value, one after the other, with a 1-second pause between each.
when flag clicked
say (score) for (1) seconds
say (lives) for (1) seconds
say (level) for (1) seconds
All three numbers read 0 — because every new variable starts at 0. Next lesson, we'll set them to other numbers and watch the watchers update live.
Recap 2 min
Today you met the orange Variables category — a brand-new colour in your Blocks Panel. You made your first variable, score, and a tiny orange watcher appeared on the Stage to display its value. The round (score) reporter slots into any round number socket. Variables are the boxes that let Scratch finally remember.
- Variable
- A named box that stores one number (or word). Scratch remembers what's inside, even between clicks.
- Make a Variable
- The button at the top of the orange Variables category. Click it, type a name, click OK — a new variable is born.
- Reporter
- A round, oval-shaped block that reports a value. The (score) block is a reporter. Drop it into any round number socket.
- Watcher
- The small orange label on the Stage that shows a variable's current value live. Tick the box in the panel to show it, untick to hide it.
Homework 1 min
Your bedroom dashboard. Open Scratch and make three variables that match your real life today: booksRead, glassesOfWater, and chores. Don't worry about changing the numbers yet — leave them all at 0. Drag the three watchers into a tidy column on the Stage.
- Take a screenshot of your Stage showing all three watchers lined up.
- Take a screenshot of your Blocks Panel on the orange Variables category, showing all three variable names listed.
Bring back next class:
- Both screenshots.
- Your written answer: "If you had to design a Pasar Pagi game, list three variables it would need and what each one would count."
Heads up for next class: SCR-L01-41 teaches the three action blocks that change what's inside the box — set, change, show / hide. The watcher numbers will start moving for real.