In nested loops, how does the break keyword behave when used inside the inner loop?

  • It generates a compilation error
  • It skips the current iteration of the inner loop
  • It terminates both the inner and outer loops
  • It terminates only the inner loop
When the break keyword is used inside an inner loop, it terminates only that inner loop and allows the outer loop to continue running. It does not affect the outer loop directly.
Add your answer
Loading...

Leave a comment

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