In this post, we will understand the difference between break and continue statements.
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 −
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 −