What is the difference between break and continue in the context of a loop? 

  • break stops the loop, continue skips to the next iteration 
  • break skips to the next iteration, continue stops the loop 
  • Both have the same function 
  • Neither is used in loops
In a loop, the break statement is used to exit the loop prematurely, halting its execution entirely. On the other hand, the continue statement skips the remaining part of the current iteration and jumps to the next iteration.
Add your answer
Loading...

Leave a comment

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