Continue Statement In C++



Break statement

The continue statement in C programming works rather like the break declaration. Rather than forcing termination, it compels the next iteration of the loop to happen, avoiding any type of code in between. For the for loop, continue declaration triggers the conditional test as well as increment portions of the loop to carry out. Within loops is used the Continue expression. Whenever there is a continuous statement inside a loop, the control jumps directly to the start of the loop for next iteration, ignoring the execution of statements inside the body of the loop for the current iteration. The continue instruction: The continue instruction causes the program to skip the rest of the loop in the present iteration as if the end of the statement block would have been reached, causing it to jump to the following iteration.

Break statement is used to break the process of a loop (while, do while and for) and switch case.

2
Syntax:break;

Example 1

2
4
6
8
10
For(intit,condition,upgrade
// codes
break;
// codes

Continue Statement:

The Continue statement is used to continue the execution of the loop. It is used inside if condition. We can use it with while, do while and for loop.

Syntax:

2
continue;

Let us take an example:

2
4
6
8
10
#include <stdio.h>
printf('Hello We are Learning C Language Tutorialn');
printf('How Are You?');// skipped
label:
}

R Continue For Loop

Output

Differentiate Break And Continue Statement In C++