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

Nested Loops

Sixth graders learn nested loops — a loop inside another loop — and how they let programs work through grids, rows, and columns, powering everything from game boards to patterns.

Grade 6Programming45 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…

  • ✓Explain a nested loop.
  • ✓See how loops combine.
  • ✓Count the repetitions.
  • ✓Use nested loops.
Essential Question

One loop repeats a line of actions — but what if you need to fill a whole grid? You put a loop INSIDE a loop! How do nested loops work?

0
Lesson Phases
0
Vocabulary Terms
0
Standards Aligned
0
Interactive Task
Explore · Interactive

Nested Loops Check

Project each item and have students answer about nested loops. The tool explains loops inside loops and grids.

🔁 Understand nested loopsTry it
Answer each question about nested loops.
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 — A Loop in a Loop

5 min

One loop makes a row — but a whole grid? Put a loop inside a loop!

👩‍🏫 Teacher Moves

  • Show a grid pattern.
  • Ask how to fill it.
  • Set the goal.

🎒 Student Actions

  • Look.
  • Wonder.
  • Predict.
2

Unplugged — Unplug It

11 min

Students practice.

👩‍🏫 Teacher Moves

  • Act out an outer and inner loop.
  • Fill a grid by hand.
  • Count the runs.

🎒 Student Actions

  • Act it.
  • Fill it.
  • Count it.
3

Use — Nested in Code

14 min

Students use.

👩‍🏫 Teacher Moves

  • Send students to Nested Loops Check.
  • Note grids.
  • Count repetitions.

🎒 Student Actions

  • Answer.
  • Note it.
  • Count.
4

Modify — Change It

10 min

Students modify.

👩‍🏫 Teacher Moves

  • Change a loop count.
  • Predict the total.
  • Explain the change.

🎒 Student Actions

  • Change it.
  • Predict.
  • Explain.
5

Create — Create

5 min

Students conclude.

👩‍🏫 Teacher Moves

  • Design a nested-loop pattern.
  • Explain the counts.
  • Complete the exit ticket.

🎒 Student Actions

  • Design it.
  • Explain 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-12

Use control structures including nested loops.

CSTA
2-AP-10

Use loops to solve problems.

CSTA
2-AP-11

Recognize patterns in code.

ISTE
5

Computational Thinker.

Differentiation

One lesson, every learner

Multilingual Learners

ELL / EMERGING READERS
  • Loop diagram cards.
  • Sentence frame: “The inner loop runs ___ times.”
  • Use a grid.

Support & Access

IEP / 504
  • Start with a 2×2 grid.
  • Count aloud.
  • Use a diagram.

Stretch & Extend

GIFTED / EARLY FINISHERS
  • Nest three loops.
  • Make a multiplication grid.
  • Draw a pattern with loops.
Materials

What to gather

  • 📽️Projector / board
  • 🔁Grid handouts
  • 💻Nested Loops Check
  • 💻Coding tool
  • ✏️Pens
  • 🎫Exit-ticket slips
Vocabulary

Key terms — hover for a quick definition

nested loopa loop inside another loopouter loopthe loop on the outsideinner loopthe loop on the insidegridrows and columnsiterationone pass through a looprepetitiondoing something againrowa horizontal linecolumna vertical line
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 nested loop?
A loop inside another loop.
QUESTION 2
What are nested loops useful for?
Working with grids, or rows and columns, like a game board.
QUESTION 3
If an outer loop runs 2 times and an inner loop runs 5 times, how many times does the inner code run?
10 times (2 × 5).

Create: nest a loop.

Have students describe a grid or pattern they could make with a nested loop. A printable nested-loops 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.

🃏 Nested LoopsFlip
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.

📝 Nested LoopsQuiz
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.

🖨️ Nested LoopsPrint
Name: ________________________
Date: ____________

Part A · Write the word that matches each meaning

Word bank: column, grid, inner loop, iteration, nested loop, outer loop, repetition, row
  1. the loop on the outside
  2. a horizontal line
  3. rows and columns
  4. a loop inside another loop
  5. the loop on the inside
  6. one pass through a loop
  7. doing something again
  8. a vertical line

Part B · Show what you learned

  1. What is a nested loop?
  2. What are nested loops useful for?
  3. If an outer loop runs 2 times and an inner loop runs 5 times, how many times does the inner code run?
Answer key — Part A: 1) outer loop · 2) row · 3) grid · 4) nested loop · 5) inner loop · 6) iteration · 7) repetition · 8) column
Part B: 1) A loop inside another loop. 2) Working with grids, or rows and columns, like a game board. 3) 10 times (2 × 5).