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
Example 2
2 4 6 8 10 12 | #include <stdio.h> inti; if(i2) continue; printf('%d n',i); } |
Output
2 4 6 | 1 4 |
Difference Between Break And Continue Statement In C++
Goto Statement
Continue Statement Is Used In C For
Goto statement is used to transfer the unconditional program control to a labeled statement.
Syntax:
2 | Gotoidentifier; |
Example:
2 4 6 8 10 | #include <stdio.h> printf('Hello We are Learning C Language Tutorialn'); printf('How Are You?');// skipped label: } |