When writing programs, we often have logic when need to repeat. We could write out the logic multiple times, but repeating code can take a lot of time and be difficult to change.

In this lesson, we will discuss loops. Loops are a way we can define actions we want to repeat, as well as the way they are repeated.

We will discuss three types of loops in this lesson, which manage repetition in three different ways:

  • While Loops
  • For Loops
  • For Each Loops

We will explore each in detail over the following exercises.


Watch this video to learn more about looping. When ready, move to the next exercise.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?