How does a break statement inside a nested loop behave?

  • It causes a runtime error.
  • It exits all loops in the current iteration.
  • It exits only the innermost loop.
  • It terminates the entire program.
A break statement inside a nested loop will exit only the innermost loop where it's encountered. This behavior allows you to break out of the current loop level without affecting outer loops. If needed, you can label loops to specify which loop to break out of explicitly.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *