Learn
Great job! In this lesson, we learned how to write cleaner code with loops. You now know:
- Loops perform repetitive actions so we don’t have to code that process manually every time.
- How to write
for
loops with an iterator variable that increments or decrements - How to use a
for
loop to iterate through an array - A nested
for
loop is a loop inside another loop while
loops allow for different types of stopping conditions- Stopping conditions are crucial for avoiding infinite loops.
do...while
loops run code at least once— only checking the stopping condition after the first execution- The
break
keyword allows programs to leave a loop during the execution of its block
Take this course for free
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.