With Tek
What is a variable in coding
A variable in coding is a box with a name that holds a value: the name stays the same, and the value inside can change, like a game's score going from 2 to 3. In this course your kid makes a score box from a cup with a paper label, writes code cards that set it, change it, and read it, and then uses it in a rule that decides when the game is won. A grown-up plays the robot and follows the cards during a sock-toss game. Tek hosts four short films for kids 6 to 13, and the whole course ends on paper and at home, with no screen. Your kid ends with a sock-toss game that keeps score. Plan about 4 minutes of films and 30–45 minutes of play. On Kubrio, all four films and the quiz are free, with no account.
All 4 lessons and the quiz are free on this page. Your kid doesn't need an account. See every lesson
Liked this lesson?
There's a whole world of this.
In Kubrio Worlds your kid explores places, asks the people who made them anything, and makes their own things. You set the screen time.
3 days free, then $49 $19 a month per kid.
▶ 1:45 tourWhat your kid makes
Your kid ends with a sock-toss game that keeps score: a labeled score cup, a misses cup, and a set of paper code cards that set, change, read, and check the score. Score, lives, coins, and time in video games all work the same way, as boxes with names.
- Ages
- 6 to 13
- Time
- 4 films, about 4 minutes, then 30–45 minutes of play
- You need
- A clear cup and a paper label, 10 buttons or dry beans, a sock and a laundry basket, paper and a pencil for the code cards, a grown-up to play the robot
- Host
- Tek
The 4 lessons
Lesson 1. A box with a name
A variable is a box with a name that holds a value. The name stays the same, and the value inside can change. It varies, so coders call it a variable.
- Find a cup and stick on a label that says score
- Grab ten buttons or dry beans to count with
- Toss a sock into a basket, and drop in a button for every sock that lands
Where: At home
Lesson 2. Set it, change it
Set puts a brand new value in the box, like zero at the start of a game. Change adds to the value already there, like one more button for every sock that lands in.
- Write a card: set score to 0
- Write a card: when the sock lands in, change score by 1
- Play while your grown-up robot keeps score
Where: At home
Lesson 3. Read it
Reading a variable tells you the value without changing it. A second box with its own name, misses, keeps a second number, so the robot always knows which box to use.
- Write a card: say score
- Make a second cup called misses
- Play five tosses, then ask the robot to say score and say misses
Where: At home
Lesson 4. Use it in a rule
An if card reads the variable and makes the game decide: if score is 3, you win. Change the 3 to a 5, and the game gets harder.
- Write a card: if score is 3, shout you win and dance
- After every toss, the robot changes the score, reads it, and checks the rule
- Change the 3 to a 5 to make it harder
Where: At home
Take the quiz
Tek asks 3 questions about the films. Get 2 right and you finish the course.
Transcript
Lesson 1: A box with a name
Hi, I'm Tek! Here's a game. Toss a sock into a basket. In! In again! So what's the score?
You know it's two. But a robot can't keep a number in its head, unless you give it a place to keep it.
Coders call that place a variable. It's like a box with a name on it.
This box is called score. Inside, it holds a value. Right now, the value is two.
The name stays the same, but the value inside can change. It varies. That's why it's called a variable!
Your turn. Find a cup, and stick on a label that says score. Then grab ten buttons or dry beans to count with.
Lesson 2: Set it, change it
Your score box is ready. Now your grown-up plays the robot, and you write the cards!
Card one: set score to zero. Every game starts fresh, so the robot empties the cup.
Card two: when the sock lands in, change score by one. The robot drops in one button.
Toss! In! Plus one. Toss! A miss. Nothing changes. Toss! In! Plus one more.
Set puts in a brand new value. Change adds to the value that's already there.
Your turn. Write two cards. Set score to zero, and change score by one. Then play, and let your robot keep score.
Lesson 3: Read it
Your robot keeps score. But how do you find out the score? You read the variable!
New card: say score. The robot looks in the box, counts the buttons, and says the number. Two!
Reading doesn't change the value. The buttons stay in the cup. Say it again. Still two.
A game can have more than one box. Make a second cup, called misses. Miss the basket? Change misses by one.
Each box has its own name. So the robot always knows which box to change, and which one to read.
Your turn. Make a misses cup. Play five tosses. Then ask your robot to say score, and say misses.
Lesson 4: Use it in a rule
Now the real coder move. Use your variable to make the game decide!
New card: if score is three, the robot shouts, you win! And does a victory dance.
After every toss, the robot changes the score, reads it, and checks the rule. Two? Not yet.
Toss! In! Plus one. The score is three. You win!
Too easy? Change the three to a five. Now you need five to win. You're the game designer.
Lots of games use variables. Score, lives, coins, and time. Each one is a box with a name!
Your turn. Write your win card, and play the whole game with your robot. You made a game that keeps score!
Free guides to practise with
Questions parents ask
What is a variable in coding, in kid terms?
A box with a name that holds a value. In the course, the box is a cup labeled score, and the value is the buttons inside. The name stays the same while the value changes, which is why it's called a variable. Games use variables for the score, lives, coins, and time.
Does my kid need a computer or a coding app?
No. The films play on this page, and the coding happens on paper cards at home. A grown-up plays the robot and follows only what the cards say. The course ends on paper, with no screen.
Is this safe with younger brothers and sisters around?
The game is a sock toss, so nothing in it is sharp or hot. Buttons and dry beans are small, so keep the buttons and beans away from babies and toddlers, or count with bigger things like toy blocks.
