Syntax of continue statement continue; Example: continue statement inside for loop. As you can see that the output is missing the value 3, however the for loop iterate though the num value 0 to 6. This is because we have set a condition inside loop in such a way, that the continue statement is encountered when the num value is equal to 3.
-->Executes statement repeatedly until expression evaluates to zero.
Syntax
Remarks
The test of expression takes place before each execution of the loop; therefore, a while loop executes zero or more times. expression must be of an integral type, a pointer type, or a class type with an unambiguous conversion to an integral or pointer type.
A while loop can also terminate when a break, goto, or return within the statement body is executed. Use continue to terminate the current iteration without exiting the while loop. continue passes control to the next iteration of the while loop.
The following code uses a while loop to trim trailing underscores from a string:
While Statement Dev C Download
The termination condition is evaluated at the top of the loop. If there are no trailing underscores, the loop never executes.
See also
Iteration Statements
Keywords
do-while Statement (C++)
for Statement (C++)
Range-based for Statement (C++)
Continue statement is used inside loops. Whenever a continue statement is encountered inside a loop, control directly jumps to the beginning of the loop for next iteration, skipping the execution of statements inside loop’s body for the current iteration.
While Statement Dev C 2017
Syntax of continue statement
Example: continue statement inside for loop
As you can see that the output is missing the value 3, however the for loop iterate though the num value 0 to 6. This is because we have set a condition inside loop in such a way, that the continue statement is encountered when the num value is equal to 3. So for this iteration the loop skipped the cout statement and started the next iteration of loop.
Output:
Flow Diagram of Continue Statement
Example: Use of continue in While loop
Output:
While Loop Dev C++
Example of continue in do-While loop
Dev C++ Programs
Output: