This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Which loop is best suited when you know in advance how many times you want to repeat an action?
while loop
for loop
if statement
What does the break statement do inside a loop?
Skips the current iteration and moves to the next one.
Restarts the loop from the beginning.
Exits the loop immediately, regardless of the loop condition.
What does the continue statement do inside a loop?
Exits the loop immediately.
Skips the rest of the current iteration and moves to the next one.
Pauses the loop until the user presses a key.
You must answer all questions before checking your work.
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?