Please enable JavaScript to use CodeHS

Fundamentals of Cybersecurity

Lesson 13.3 Looping

Description

In this lesson, students learn how to use for loops and while loops in their programs. For loops allow Karel to repeat a specific part of code a fixed number of times, and while loops allow Karel to repeat a specific part of code while a certain condition is true. Additionally, while loops allow students to create general solutions to problems that will work on multiple Karel worlds, rather than just one.


Objective

Students will be able to:

  • Explain when a for loop should be a used and when a while loop should be used
  • Create for loops to repeat code a fixed number of times
  • Create while loops to repeat code while a condition is true
  • Test their solutions on different Karel worlds