Home›Lesson Plans›Computer Science›Computer Science · Grade 7

Variables in Code

Seventh graders learn about variables — named containers that store and update information in a program — the building blocks that let code remember scores, names, and any data it needs.

Grade 7Programming45 minutes1 class periodUse → Modify → CreateExplicit teaching4 StandardsCSTA
Start the Lesson
Lesson at a Glance

Everything you need before the bell rings

Learning Objectives

Students will be able to…

  • ✓Define a variable.
  • ✓Assign and update a value.
  • ✓Explain data types.
  • ✓Use variables in code.
Essential Question

How does a game remember your score, or an app remember your name? It stores them in variables. What is a variable, and how does code use one?

0
Lesson Phases
0
Vocabulary Terms
0
Standards Aligned
0
Interactive Task
Match It · Interactive

Match the Variable Terms

Project this and match each programming term to its meaning — tap a term, then tap what it means.

📦 Match each variable term to its meaningTry it
Term
What It Means
Now tap its meaning!
The Lesson · Use → Modify → Create (a coding progression with Unplugged practice)

45 minutes, five moves

Tap any phase to open the teacher moves and student actions.

1

Hook — The Score Keeper

5 min

How does a game remember your score? It uses a variable!

👩‍🏫 Teacher Moves

  • Show a changing score.
  • Ask how it’s stored.
  • Set the goal.

🎒 Student Actions

  • Consider.
  • Wonder.
  • Predict.
2

Unplugged — Unplug It

10 min

Students practice.

👩‍🏫 Teacher Moves

  • Use labeled boxes as variables.
  • Put values in and out.
  • Feel the idea.

🎒 Student Actions

  • Label boxes.
  • Swap values.
  • Feel it.
3

Use — Variable Terms

13 min

Students use.

👩‍🏫 Teacher Moves

  • Send students to Match the Variable Terms.
  • Match each one.
  • Note data types.

🎒 Student Actions

  • Match.
  • Note types.
  • Explain.
4

Modify — Change It

12 min

Students modify.

👩‍🏫 Teacher Moves

  • Update a variable’s value.
  • Predict the result.
  • Explain the change.

🎒 Student Actions

  • Update it.
  • Predict.
  • Explain.
5

Create — Create

5 min

Students conclude.

👩‍🏫 Teacher Moves

  • Create a variable for a program.
  • Assign a value.
  • Complete the exit ticket.

🎒 Student Actions

  • Create it.
  • Assign it.
  • Complete the exit ticket.
Standards Alignment

Built to the standards you report on

Aligned to the CSTA K-12 Computer Science Standards and ISTE Standards for Students.

CSTA
2-AP-11

Create clearly named variables that store data.

CSTA
2-AP-13

Decompose problems using variables.

CSTA
2-AP-17

Systematically test and refine programs.

ISTE
5

Computational Thinker.

Differentiation

One lesson, every learner

Multilingual Learners

ELL / EMERGING READERS
  • Term + meaning cards.
  • Sentence frame: “A ___ stores ___.”
  • Use labeled boxes.

Support & Access

IEP / 504
  • Start with variable and value.
  • Match one pair at a time.
  • Use real containers.

Stretch & Extend

GIFTED / EARLY FINISHERS
  • Use variables in a program.
  • Explain scope.
  • Use several data types.
Materials

What to gather

  • 📽️Projector / board
  • 📦Labeled boxes
  • 💻Match the Variable Terms
  • 💻Coding tool (optional)
  • ✏️Pencils
  • 🎫Exit-ticket slips
Vocabulary

Key terms — hover for a quick definition

variablea named container for a valuevaluethe data stored in a variableassignto put a value into a variabledata typethe kind of value storedstringtext dataintegera whole-number valuebooleana true/false valueupdateto change a stored value
Evaluate

Exit Ticket

Preview the three formative checks. Tap “Sample answer” to see what mastery looks like — hide them before you print for students.

QUESTION 1
What is a variable?
A named container that stores a value in a program.
QUESTION 2
What does it mean to assign a value?
To put a value into a variable, like score = 5.
QUESTION 3
Name a data type.
Number (integer), text (string), or true/false (boolean).

Create: name your variables.

Have students name three variables a simple game would need (like score, lives, playerName) and what each stores. A printable variables sheet is in the Computer Science library.

Study · Flashcards

Study the key terms

Tap a card to flip it, then rate whether you knew it. Built from this lesson’s vocabulary.

🃏 VariablesFlip
Card 1
Term
Tap to flip →
Meaning
0

Nice work!

Practice · Quiz

Check your understanding

A quick self-check with instant feedback, drawn from this lesson’s key terms.

📝 VariablesQuiz
Score: 0
1 / 6
Question 1
0%

Nice work!

Practice · Worksheet

Printable worksheet

A print-and-go review sheet with a built-in answer key. Tap “Show answer key” to reveal answers, or print the clean version for students.

🖨️ VariablesPrint
Name: ________________________
Date: ____________

Part A · Write the word that matches each meaning

Word bank: assign, boolean, data type, integer, string, update, value, variable
  1. to put a value into a variable
  2. the data stored in a variable
  3. a whole-number value
  4. a true/false value
  5. to change a stored value
  6. text data
  7. a named container for a value
  8. the kind of value stored

Part B · Show what you learned

  1. What is a variable?
  2. What does it mean to assign a value?
  3. Name a data type.
Answer key — Part A: 1) assign · 2) value · 3) integer · 4) boolean · 5) update · 6) string · 7) variable · 8) data type
Part B: 1) A named container that stores a value in a program. 2) To put a value into a variable, like score = 5. 3) Number (integer), text (string), or true/false (boolean).