Multiple choice

Break statement is used to terminate _____ loop(s).

  1. for

  2. while

  3. do-while

  4. all of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The break statement immediately terminates the nearest enclosing loop or switch statement. It works with all loop types - for, while, and do-while - as well as switch statements, transferring control to the statement following the loop/switch.