Back to Kids Home
📦 Lesson 1

Variables are Magic Boxes! 📦✨

Imagine you have special boxes that can hold ANYTHING - numbers, words, even your name!

🤔 What is a Variable?

A variable is like a special box with a name written on it. You can put things inside the box and take them out whenever you need them!

📦
Box named "myAge"
10

This box holds the number 10!

📦
Box named "myName"
"Sam"

This box holds the name Sam!

🌍 Variables in Real Life

You use variables every day without knowing it!

🎒

Your Backpack

Changes what's inside every day!

🏷️

Your Name Tag

Holds your name for everyone to see!

🏆

Score Board

The score changes during a game!

🪄 How to Create a Magic Box

In coding, we create a variable like this:

let favoriteColor = "blue"
📝
let

Says "I'm making a box!"

🏷️
favoriteColor

The name of the box

🎁
"blue"

What's inside the box

🔄 You Can Change What's Inside!

The cool thing about variables is you can change them! Just like emptying a toy box and putting new toys in.

📦
score = 0

Game starts

➡️
📦
score = 10

You scored!

➡️
📦
score = 25

Even more points!

🎨 What Can You Store in a Variable?

Variables can hold different types of information!

🔢

Numbers

age = 10
📝

Words (Text)

name = "Emma"

Yes or No

isHappy = true
📋

Lists

pets = ["dog", "cat"]

🎮 Think About It!

Can you think of variables in a video game you play?

❤️

Player Health

Goes down when you get hit!

💰

Coins Collected

Goes up when you find coins!

Level Number

Changes when you beat a level!

👤

Player Name

Stays the same (usually)!

Remember This!

  • 1

    Variables are like labeled boxes that store information

  • 2

    Every variable has a name (like "score") and a value (like 100)

  • 3

    You can change what's inside a variable anytime!

  • 4

    Variables can hold numbers, words, yes/no, and more!