Skip to content

Iteration (Loops) in AlgorithmsActivities & Teaching Strategies

Active learning helps Year 7 students grasp iteration by making abstract loop concepts tangible. Through hands-on coding and collaboration, students see firsthand how loops reduce repetitive work and solve real problems efficiently, building both understanding and confidence in algorithm design.

Year 7Technologies4 activities20 min45 min

Learning Objectives

  1. 1Construct algorithms using 'for' loops to repeat a specified number of times.
  2. 2Design algorithms employing 'while' loops to repeat instructions based on a given condition.
  3. 3Compare the efficiency of iterative algorithms against manually repeated instructions.
  4. 4Analyze and explain scenarios where a 'for' loop is more suitable than a 'while' loop, and vice versa.

Want a complete lesson plan with these objectives? Generate a Mission

30 min·Pairs

Pair Programming: Shape Repeater

Pairs take turns: one writes a 'for' loop to draw repeated shapes in a block-based tool like Scratch, the other tests and suggests improvements. Switch roles after 10 minutes. Share one successful pattern with the class.

Prepare & details

Construct an algorithm using a loop to perform a repetitive task.

Facilitation Tip: During Pair Programming: Shape Repeater, circulate and ask each pair to explain their loop setup before they run the code, ensuring they connect the repetition count to the loop’s purpose.

Setup: Varies; may include outdoor space, lab, or community setting

Materials: Experience setup materials, Reflection journal with prompts, Observation worksheet, Connection-to-content framework

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness
45 min·Small Groups

Stations Rotation: Loop Challenges

Set up stations with tasks: station 1 uses 'for' for countdowns, station 2 'while' for guessing games, station 3 compares both for efficiency. Groups rotate every 10 minutes, coding and timing manual vs looped versions.

Prepare & details

Compare the efficiency of iterative solutions versus manual repetition.

Facilitation Tip: In Station Rotation: Loop Challenges, set a timer for 8 minutes per station and provide a one-page reference guide with loop examples to reduce cognitive load for struggling students.

Setup: Tables/desks arranged in 4-6 distinct stations around room

Materials: Station instruction cards, Different materials per station, Rotation timer

RememberUnderstandApplyAnalyzeSelf-ManagementRelationship Skills
25 min·Whole Class

Whole Class: Loop Debug Relay

Project buggy loop code on screen. Teams send one student at a time to fix errors in a shared editor, explaining changes aloud. Continue until the algorithm runs correctly for all test cases.

Prepare & details

Analyze scenarios where a 'while' loop is more appropriate than a 'for' loop.

Facilitation Tip: For Whole Class: Loop Debug Relay, assign roles like 'timer' and 'recorder' to keep all students engaged during the rapid debugging rounds.

Setup: Varies; may include outdoor space, lab, or community setting

Materials: Experience setup materials, Reflection journal with prompts, Observation worksheet, Connection-to-content framework

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness
20 min·Individual

Individual: Personal Loop Project

Students design a 'while' loop for a personalized task, like a multiplier game that continues until correct. Test independently, then peer review one another's code for efficiency.

Prepare & details

Construct an algorithm using a loop to perform a repetitive task.

Setup: Varies; may include outdoor space, lab, or community setting

Materials: Experience setup materials, Reflection journal with prompts, Observation worksheet, Connection-to-content framework

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness

Teaching This Topic

Teach iteration by starting with concrete examples students can visualize, like drawing shapes or moving a character. Avoid abstract explanations of loop mechanics early on; instead, focus on outcomes and efficiency gains. Research shows that students grasp loops better when they see immediate visual feedback, so prioritize block-based or simple text-based environments before moving to complex syntax.

What to Expect

By the end of these activities, students will explain when to use 'for' or 'while' loops, debug infinite loop scenarios, and justify their loop choices with clear reasoning. They will demonstrate this through written pseudocode, code outputs, and discussion contributions.

These activities are a starting point. A full mission is the experience.

  • Complete facilitation script with teacher dialogue
  • Printable student materials, ready for class
  • Differentiation strategies for every learner
Generate a Mission

Watch Out for These Misconceptions

Common MisconceptionDuring Pair Programming: Shape Repeater, watch for students assuming loops always run forever because they forget to set a repetition count or exit condition.

What to Teach Instead

Ask students to trace their loop step-by-step on paper, marking where the loop starts, how many times it repeats, and where it ends. Have them run the code and explain why the loop stops, reinforcing the role of the loop counter or condition.

Common MisconceptionDuring Station Rotation: Loop Challenges, watch for students treating 'for' and 'while' loops as interchangeable without considering the scenario’s repetition needs.

What to Teach Instead

Provide a timer-based challenge where students must choose the loop type before coding; if they pick incorrectly, the code won’t meet the task. Discuss why their choice works or fails, using the timer’s output as evidence.

Common MisconceptionDuring Whole Class: Loop Debug Relay, watch for students believing loops only work with numeric data, such as counters or sums.

What to Teach Instead

Include a challenge in the relay where students use loops to repeat non-numeric instructions, like changing colors or playing tones. After debugging, ask them to explain how the loop handled the data type and what visual or auditory feedback confirmed its success.

Assessment Ideas

Quick Check

After Pair Programming: Shape Repeater, present students with a pseudocode snippet that draws a pentagon using a 'for' loop. Ask them to identify the number of repetitions and the shape being drawn. Then, provide a scenario like 'move forward until you hit a wall' and ask which loop type would be best suited and why.

Exit Ticket

After Station Rotation: Loop Challenges, give students two simple tasks: 1. 'Draw 4 triangles in a row.' 2. 'Keep rolling a dice until you roll a six.' Ask them to write down the type of loop they would use for each task and one reason for their choice.

Discussion Prompt

During Whole Class: Loop Debug Relay, pose the question: 'Imagine you are programming a robot vacuum. Would you use a 'for' loop or a 'while' loop to clean a room until it’s spotless? Explain your reasoning, considering when the loop should stop.'

Extensions & Scaffolding

  • Challenge: Ask students to modify their Personal Loop Project to include nested loops, such as drawing a grid of shapes, and document how the inner and outer loops interact.
  • Scaffolding: Provide pre-written pseudocode with missing loop headers for students to complete in Loop Challenges, focusing on identifying the correct loop type for the task.
  • Deeper exploration: Introduce a 'do-while' loop scenario where students simulate a game retry mechanism, comparing it to 'while' loops to deepen their understanding of condition placement.

Key Vocabulary

IterationThe process of repeating a set of instructions or a block of code multiple times within an algorithm.
LoopA control flow structure that allows a block of code to be executed repeatedly, either a fixed number of times or until a specific condition is met.
For loopA loop that executes a block of code a predetermined number of times, often used when the number of repetitions is known in advance.
While loopA loop that executes a block of code as long as a specified condition remains true, used when the number of repetitions is not known beforehand.
ConditionA statement in a 'while' loop that is evaluated as either true or false; the loop continues to run as long as the condition is true.

Ready to teach Iteration (Loops) in Algorithms?

Generate a full mission with everything you need

Generate a Mission