Fill: Break from Loop
Fill in the Blank Beginner
Question
Fill in the blank to exit the loop when i equals 5.
Code
for i in range(10):
if i == 5:
___
Hint
The keyword that immediately exits a loop is...
Explanation
break immediately exits the enclosing for or while loop. When i equals 5, the loop terminates. Use continue to skip just the current iteration instead.
Related Resources
Related Lessons
- Conditions and Loops
break and continue.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.