C Break/Continue
Break
The Break statement is used to bring the program control out of the loop. The break statement is used inside loops or switch statement.
The break statement in C can be used in the following two scenarios:
- With switch case
- With loop
Syntax:
//loop or switch case
break;
Continue
The continue statement in C language is used to bring the program control to the beginning of the loop. It is mainly used for a condition so that we can skip some code for a particular condition.
Syntax:
//loop statements
continue;
//some lines of the code which is to be skipped
Break and Continue in While Loop
You can also use break and continue in while loops: