← Back to course
Code Crew G3 / Week 04 / Crew Quest
6/6
Week 04 Β· Variables

Crew Quest

// Boxes that hold things

Crew Quest: Variable Day

Rocket sticks a note on his door. It says mood equals happy. "This is my variable!" he says.

Raven smiles. "What do you notice about your mood by bedtime?" she asks.

Nova blinks. "Update it four times," she says. "Morning, lunch, afternoon, and bedtime."

Let's make our own mood variable and track it all day.

Tape a sticky note to a door. That's your VARIABLE: mood.

Update it 4 times today: morning, lunch, afternoon, bedtime.

Timemood = ?
Morning____________
Lunch____________
Afternoon____________
Bedtime____________

What did you notice?

Crew Brag Box
Show your tracker to a grown-up. β˜… Earn a star for finishing all 4 updates.

Week 4 Recap

  1. VARIABLE = box with a NAME that holds a VALUE.
  2. score = score + 1 means 'put the new total back in the box'.
  3. Good NAMES make code easy to read.
Try This Without Paper
1. Pick a 'mood variable' for the day. Update it after dinner.
2. Track how many pages you read this week; that's a variable.
3. Help count groceries into bags. Each bag is a variable.
β—‡ HUMAN VARIABLES
Each person holds a paper sign with a variable name, like score.
A caller reads lines out loud, like score = score + 2.
The person holding that sign writes the new value.
At the end, check: did everyone get the same numbers?
WEEK 4 REVIEW
  • Read the question.
  • Tap your answer.
What is a variable?
score = 4, then score = score + 1. What is score?
Which part of a variable stays the same?
lives = 3, then lives = lives - 3. What is lives?
mood = happy. Then mood = sleepy. What is mood?
level = 1. It goes up by 1 three times. What is level?
a = 7 and b = 4. Swap them with temp. What is a now?
StatementTrue or false?
A variable can hold a word, like happy.?
score = score + 1 means put the new total back in score.?
You need a third box to swap two values safely.?
Once a box has a value, it can never change.?
WHY THIS EXERCISEVariables are how programs remember and change things.

Coming up next…

Week 5: FUNCTIONS. Give a group of steps a name and reuse them.

← Friday