Multiple choice

The break statement causes an exit

  1. only from the innermost loop

  2. only from the innermost switch

  3. from the innermost loop or switch

  4. from all loops or switches

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

The 'break' statement is used to terminate the execution of the nearest enclosing loop (for, while, do-while) or switch statement. It does not exit nested loops or switches beyond the immediate one.