Difference Between break and continue


In this post, we will understand the difference between break and continue statements.

break

  • It is used to terminate the enclosing loop like while, do-while, for, or switch statement where it is declared.

  • It resumes control over the program until the end of the loop.

  • It also helps with the flow of control outside the loop.

  • It is used with ‘switch’ and ‘label’ since it is compatible.

Following is the flowchart of break statement −

continue

  • It helps skip the remaining part of the loop.

  • It continues to execute the next iteration.

  • It causes early execution of the next iteration of the enclosing loop.

  • It can’t be used with ‘switch’ and ‘label’ since it is not compatible.

Following is the flowchart of continue statement −

Updated on: 24-Mar-2021

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements