Start a free 7-day trial to check out our newest course, WordPress Basics!
Join the Treehouse affiliate program and earn 25% recurring commission!
✨ Earn college credits in Cybersecurity, JS, HTML, CSS and Python
Bummer! You must be logged in to access this page.
This course is part of our College Credit Program, designed to help you earn college credit while mastering valuable skills. If you're interested in pursuing college credit, click here to learn more.
Loops in Programming
A loop is a code block that runs a set of statements while a given condition is true. Loops are often used for performing repetitive tasks. For example:
In this chapter, two types of loops are introduced:
This chapter also introduces the break and continue statements, which are used to control a loop's execution.