• admin@embedclogic.com

break and continue statements

break statement

The break statement is used to terminate the nearest closing loop or switch-case statement.After termination of loop, control transfer to the followed statement.


Flow Diagram:

break statement role in function


15In below example, Control will remain inside the loop until positive input is not available.when positive input found control will transfer to the just outside of the immediate loop.

Continue statement

Continue statement used inside the loops. Unlike the break statement when continue found inside the loop then execution of the remaining statments of current iteration will skip as well control transfer to the start of the loop for next iteration.


Flow Diagram


In above example, you can see that count=4 is skipped because when the count equals to 4 then if statement gets true and execute the continue statement which transfers the control to initial of the loop for next iteration without executing the next statement of current execution.

Subscribe and stay updated with our latest articles.

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

Embedclogic will use the information you provide on this form to be in touch with you and to provide updates and marketing.