Bird
0
0

Why does the continue statement inside a Kotlin loop not exit the loop but only skip the current iteration?

hard📝 Conceptual Q10 of 15
Kotlin - Loops and Ranges
Why does the continue statement inside a Kotlin loop not exit the loop but only skip the current iteration?
ABecause continue is designed to skip to the next iteration, not stop the loop.
BBecause continue causes the loop to restart from the beginning.
CBecause continue throws an exception to skip iteration.
DBecause continue is equivalent to break in Kotlin.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the purpose of continue

    continue is meant to skip the rest of the current iteration and move to the next one.
  2. Step 2: Differentiate from break

    break exits the loop entirely, while continue only skips current iteration.
  3. Final Answer:

    Because continue is designed to skip to the next iteration, not stop the loop. -> Option A
  4. Quick Check:

    Continue skips iteration, break stops loop [OK]
Quick Trick: Continue skips iteration; break stops loop [OK]
Common Mistakes:
MISTAKES
  • Confusing continue with break
  • Thinking continue restarts loop
  • Assuming continue throws errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes