✦
✦
Computer Science · Coding Basics
Variables & Data Storage
A program needs to remember things — your score, your name, your lives. It stores each one in a variable: a labeled box that holds a value.
📦A Variable Is a Labeled Box
🏷️ Two parts to every variable:
The NAME is the label on the box — like score. It stays the same.
The VALUE is what's inside — like 500. You can swap it anytime!
🧰Data Types — What Fits in the Box
🔤STRING
Holds text — names, words, messages.
💬 "Hello!" · "Maya"
🔢INTEGER
Holds whole numbers — scores, lives.
🎮 score = 500 · lives = 3
🚦BOOLEAN
Holds true / false — yes-or-no facts.
🚪 doorLocked = true
⚡Values Can Change as the Program Runs
# make a variable and assign it a value
set score = 500
# you win! the box keeps its label, the value goes up
set score = score + 100 → now score is 600
🔑Key Terms
📦Variable A named container that stores data that can change.
🧰Data Type The kind of data a variable holds (number, text, true/false).
🔤String A data type that holds text.
🔢Integer A whole number with no decimal.
🚦Boolean A data type with only two values: true or false.
✍️Assign To give a variable a value.
⭐
Remember: a variable is a named box your program remembers — and the whole point is that its value can change while the program runs!