What is the purpose of the 'break' statement within a loop?

  • Continue to the next iteration
  • Exit the loop
  • Print a message
  • Skip the current iteration
The 'break' statement is used to exit a loop prematurely. When encountered, it terminates the loop and continues with the next code after the loop.
Add your answer
Loading...

Leave a comment

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