A variable is like a storage box in your robot’s brain.
Think of it as:
📦 Label: score → Inside: 0
Variables help the robot keep track of things.
Imagine you’re running a lemonade stall.
You use:
A jar to store money collected
A notepad to track cups sold
Both are like variables — holding and updating values as things change.
Here’s what robots might store using variables:
Temperature from a sensor
Battery level
How many steps walked
Whether a switch is ON or OFF (true/false)
For example:
battery = 80 If battery < 20 → Show “Low Battery”
The robot remembers and compares the value when needed.
During a cricket match:
runs = 0
Every time a run is scored → runs = runs + 1
The scoreboard is like a robot’s variable – it keeps updating based on events!
Numbers (like 5, 100) → for speed, time, distance
Text (like "Hello") → for names or messages
True/False (also called Boolean) → for yes/no or on/off
A robot vacuum can store:
dirtLevel = 3
areaCleaned = 25 (in square meters)
areaCleaned = 25
needsRecharge = false
Based on these, it makes smart decisions like:
If areaCleaned > 50 → Go to charging dock
Try thinking of a robot that feeds pets.
Time of last feeding
Amount of food left
Pet weight
Variables give robots memory and awareness.