Learn Java: Loops
Introduction to Loops

In the programming world, we hate repeating ourselves. There are two reasons for this:

  • Writing the same code over and over is time-consuming.
  • Having less code means having less to debug.

But we often need to do the same task more than once. Fortunately, computers are really good (and fast) at doing repetitive tasks. And in Java, we can use loops.

A loop is a programming tool that allows developers to repeat the same block of code until some condition is met. We employ loops to easily scale programs, saving time and minimizing mistakes.

We’ll go over three types of loops that you’ll see everywhere:

  • while loops
  • for loops
  • for-each loops


Move on to the next exercise when you’re ready to learn how to build loops in Java.

Folder Icon

Take this course for free

Already have an account?