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

Loops: For vs While

Tenth graders learn the two main kinds of loops — for loops that repeat a known number of times, and while loops that repeat until a condition changes — and how to choose the right one for a task.

Grade 10Programming50 minutes1 class periodUse → Modify → CreateExplicit teaching4 StandardsCSTA
Start the Lesson
Assign or share this lesson

Copy link works with Canvas, Schoology, Moodle and any other LMS — paste it in as a resource or assignment.

Lesson at a Glance

Everything you need before the bell rings

Learning Objectives

Students will be able to…

  • ✓Explain for loops.
  • ✓Explain while loops.
  • ✓Choose the right loop.
  • ✓Use loops in code.
Essential Question

All loops repeat code — but a FOR loop and a WHILE loop are used in different situations. When do you use each one?

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

For Loop or While Loop?

Project this and sort each task by whether a FOR loop or a WHILE loop fits best.

🔁 Sort each task — FOR loop or WHILE loop?Try it
🔢 Use a FOR loop
❓ Use a WHILE loop
Tap a task, then tap a bucket.
The Lesson · Use → Modify → Create (a coding progression with Unplugged practice)

50 minutes, five moves

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

1

Hook — Two Kinds of Loops

5 min

All loops repeat — but when do you use FOR vs WHILE?

👩‍🏫 Teacher Moves

  • Show both loop types.
  • Ask when to use each.
  • Set the goal.

🎒 Student Actions

  • See them.
  • Wonder.
  • Predict.
2

Unplugged — Unplug It

11 min

Students practice.

👩‍🏫 Teacher Moves

  • Act out a for loop (fixed count).
  • Act out a while loop (condition).
  • Feel the difference.

🎒 Student Actions

  • Count it.
  • Wait for it.
  • Feel it.
3

Use — For or While

14 min

Students use.

👩‍🏫 Teacher Moves

  • Send students to For Loop or While Loop?
  • Sort each task.
  • Explain them.

🎒 Student Actions

  • Sort them.
  • Explain.
  • Check.
4

Modify — Rewrite It

14 min

Students modify.

👩‍🏫 Teacher Moves

  • Rewrite a for loop as a while loop.
  • Predict the result.
  • Explain the choice.

🎒 Student Actions

  • Rewrite.
  • Predict.
  • Explain.
5

Create — Create

6 min

Students conclude.

👩‍🏫 Teacher Moves

  • Write a for and a while loop.
  • Explain when each fits.
  • Complete the exit ticket.

🎒 Student Actions

  • Write them.
  • Explain.
  • 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
3A-AP-14

Use control structures including loops.

CSTA
3A-AP-16

Design and iterate programs with loops.

CSTA
3A-AP-17

Decompose problems into repeated steps.

ISTE
5

Computational Thinker.

Differentiation

One lesson, every learner

Multilingual Learners

ELL / EMERGING READERS
  • Loop-type task cards.
  • Sentence frame: “Use a ___ loop when ___.”
  • Act out loops.

Support & Access

IEP / 504
  • Start with fixed-count vs. until.
  • Sort one at a time.
  • Use examples.

Stretch & Extend

GIFTED / EARLY FINISHERS
  • Write nested loops.
  • Explain infinite loops.
  • Use loops with lists.
Materials

What to gather

  • 📽️Projector / board
  • 🔁Loop task cards
  • 💻For Loop or While Loop?
  • 💻Coding tool
  • ✏️Pens
  • 🎫Exit-ticket slips
Vocabulary

Key terms — hover for a quick definition

loopcode that repeatsfor looprepeats a known number of timeswhile looprepeats until a condition changesconditiona true/false testiterationone pass through a loopcountera variable that counts loopsinfinite loopa loop that never stopscontrol structurecode that directs the flow
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
When would you use a FOR loop?
When you know how many times to repeat — like going through every item in a list.
QUESTION 2
When would you use a WHILE loop?
When you repeat until a condition changes — like “until the user types yes.”
QUESTION 3
What is an infinite loop?
A loop whose condition never becomes false, so it never stops.

Create: pick the loop.

Have students write two short tasks — one for a for loop and one for a while loop — and explain why each fits. A printable 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.

🃏 Loops: For vs WhileFlip
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.

📝 Loops: For vs WhileQuiz
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.

🖨️ Loops: For vs WhilePrint
Name: ________________________
Date: ____________

Part A · Write the word that matches each meaning

Word bank: condition, control structure, counter, for loop, infinite loop, iteration, loop, while loop
  1. repeats until a condition changes
  2. repeats a known number of times
  3. a variable that counts loops
  4. a true/false test
  5. a loop that never stops
  6. code that repeats
  7. one pass through a loop
  8. code that directs the flow

Part B · Show what you learned

  1. When would you use a FOR loop?
  2. When would you use a WHILE loop?
  3. What is an infinite loop?
Answer key — Part A: 1) while loop · 2) for loop · 3) counter · 4) condition · 5) infinite loop · 6) loop · 7) iteration · 8) control structure
Part B: 1) When you know how many times to repeat — like going through every item in a list. 2) When you repeat until a condition changes — like “until the user types yes.” 3) A loop whose condition never becomes false, so it never stops.