VOOZH about

URL: https://www.simplilearn.com/tutorials/cpp-tutorial/break-and-continue-statements-cpp

⇱ Difference Between Break And Continue in C++ | Simplilearn


HomeResourcesSoftware DevelopmentC++ Tutorial for BeginnerDifference Between Break And Continue Statements In C++
Tutorial Playlist
C++ Tutorial for BeginnerOverview
The Easiest Guide to Understand and Learn C++ BasicsLesson - 1All You Need to Know About Classes in C++Lesson - 2The Difference Between C++ and CLesson - 3The Ultimate Guide to Learn About C++ EnumLesson - 4An Easy Guide To Understand The C++ ArrayLesson - 5The Best Guide to C++ For Loop : For Loops Made EasyLesson - 6Everything You Need to Know About C++ VectorLesson - 7The Easiest Way to Understand C++ FunctionsLesson - 8Call by Value and Call by Reference in C++Lesson - 9The Ultimate Step-by-Step Guide to Learn Pointers in C++Lesson - 10The Complete Guide to Learn the Difference Between Coding Vs ProgrammingLesson - 11C++ Object-Oriented Programming : The Best Way to Learn C++ OopsLesson - 12The Supreme Guide to Build the Tic Tac Toe Game in C++Lesson - 13The Best Guide to Create the C++ GUI ApplicationLesson - 14C++ vs. Python: Everything You Need to KnowLesson - 15What Is Sorting in C++: Bubble Sort, Insertion Sort & MoreLesson - 16The Best Explanation to Break and Continue Statements in C++Lesson - 17The Best Guide to Understand C++ Header FilesLesson - 18C++ Recursion: Understanding Its Concept and WorkingLesson - 19Top 60 C++ Interview Questions and Answers for 2026Lesson - 20C# Vs. Java: Which Is the Best Programming Language?Lesson - 21The Ultimate Guide to Learn C++ STL (Standard Template Library)Lesson - 22The Top 10 Reasons to Learn C++ Language in 2026Lesson - 23C++ Projects for Beginners : The Best Article for Beginner-Level ProjectsLesson - 24

Difference Between Break And Continue Statements In C++

Lesson 17 of 24

By Harsh BhardwajLast updated on Sep 10, 2025105188

Table of Contents

View More

Both Break and Continue are known as jump statements. Sometimes you might want to skip statements inside the loop, and sometimes you might want the loop to terminate. In situations like these, break and continue statements come in handy. In this tutorial, you will learn about Break and Continue statements in C++.

Want a Top Software Development Job? Start Here!AI-Powered Full Stack Developer ProgramExplore Program

What Are Break and Continue Statements in C++?

Break and continue are known as jump statements because they are generally used to change or manipulate the regular flow of the program, loops, etc. when a particular condition is met.

The break statement is used to terminate the execution of the current loop. Whenever there is a need to end the loop, you need to add the break statement. Once the break statement is met, all the iterations are stopped, and the control is shifted outside the loop.

Automation Test Engineer Master's ProgramTo learn about the automation of web applicationsExplore Course

The continue statement is used to move to the next iteration, it is also used for termination, but unlike break, it is not used to terminate the entire execution of the loop but only the current iteration of the loop.

Now you will learn about the working of Break and Continue statements in C++.

How Does the Break Statement Work?

The break statement helps with leaving the loop even before its termination condition is met. The break statement basically stops the execution of the loop. Inside the loop body, there is a condition on which you will set the break statement, or you can say on which you want to break the loop; whenever that condition is met, then the execution of the loop is terminated.

πŸ‘ C++Example7.

In case the if condition is not true, then it will move to the next iteration.

Now, understand it with the help of an example.

πŸ‘ Break_and_Continue_in_C++_Example2.

Here the loop is iterating from 0 to 10. Inside the loop, there is a condition and then the break statement, ensuring that the loop will terminate when i becomes equal to 4.

After the break statement, the control will jump out of the loop body.

This is the output of the example.

πŸ‘ Break_and_Continue_in_C++_Example8.

Want a Top Software Development Job? Start Here!AI-Powered Full Stack Developer ProgramExplore Program

How Does the Continue Statement Work?

The continue statement helps in skipping a particular iteration of the loop. It doesn’t stop the complete execution of the loop; it just skips that particular iteration and then continues with the next iteration.

Inside the loop, if the condition is met, then it will skip the iteration and then continue with the next one. But if the condition is not true, then it will execute the remaining part of the loop.

πŸ‘ Break_and_Continue_in_C++_Example3.

Now, understand the continue statement with the help of an example.

πŸ‘ Break_and_Continue_in_C++_Example4.

Here the loop is iterating from 0 to 10.

Inside the loop, there is a condition and then the continue statement that will ensure that if the value of i becomes 4, then terminate that iteration and move to the next iteration.

After that, elements are getting printed with the help of cout function.

This is the output of the example.

πŸ‘ Break_and_Continue_in_C++_Example9.

Now, understand with an example in which you will use both break and continue statements.

πŸ‘ Break_and_Continue_in_C++_Example5

In this example, there are two kinds of racing that take place. One is a drag race, and another one is a lap race. The condition for a drag race is there must be each and every car present before the race, or the race will not take place, but in a lap race, there is no such condition, if any car is not present in lap race we can skip that car.

Inside the drag race, there is a condition saying that car number 4 is not there, so a break statement is used inside that condition because the race will not proceed. So, there is no point in counting the cars anymore.

Inside the lap race, there is the same condition, but in this case, you used the continue statement because you know the race will still take place even if some cars don't participate. So continue will skip that car number and continue with the next.

This is the output.

πŸ‘ Break_and_Continue_in_C++_Example6.

Now, understand the difference between Break and Continue statements in C++.

Automation Test Engineer Master's ProgramTo learn about the automation of web applicationsExplore Course

Difference Between Break and Continue Statement in C

Break

Continue

Break statement stops the entire process of the loop.

Continue statement only stops the current iteration of the loop.

Break also terminates the remaining iterations.

Continue doesn’t terminate the next iterations; it resumes with the successive iterations.

Break statement can be used with switch statements and with loops

Continue statement can be used with loops but not switch statements.

In the break statement, the control exits from the loop.

In the continue statement, the control remains within the loop.

It is used to stop the execution of the loop at a specific condition.

It is used to skip a particular iteration of the loop.

Accelerate your career as a skilled MERN Stack Developer by enrolling in a unique Full Stack Developer - MERN Stack Master's program. Get complete development and testing knowledge on the latest technologies by opting for the MERN Stack Developer Course. Contact us TODAY!

Conclusion

After reading this tutorial on Break and Continue statements in C++, you would have understood the basics of Break and Continue statements. You learned about the working of break and continue statements in C++ with the help of some examples. You also looked at the difference between Break and Continue statements.

If you are looking to build a career in software development, then you can check the Full Stack Developer - MERN Stack by Simplilearn. It can prove to be the perfect solution to help you build your career towards the right direction.

Do you have any questions regarding this β€˜Break and Continue statements in C++’ tutorial? If you do, then you can put them in the comments section. We’ll help you solve your queries. To learn more about Break and Continue statements in C++, click on the following link: Break and Continue statements in C++.

About the Author

πŸ‘ Harsh Bhardwaj
Harsh Bhardwaj

Harsh Bhardwaj is currently working as a Research analyst at Simplilearn digital content marketing team. He holds a bachelor’s degree in Computer Science Engineering. He is proficient in C++, Java, CSS, HTML, Bootstrap, and query language like SQL and worked on web development framework like React.

View More

Recommended Programs

πŸ‘ Full Stack Java Developer Masters Program

Full Stack Java Developer Masters Program

1029 Learners
Lifetime Access*
πŸ‘ AI-Powered Full Stack Developer Program

AI-Powered Full Stack Developer Program

1594 Learners
Lifetime Access*
πŸ‘ Java Certification Training

Java Certification Training

16365 Learners

*Lifetime access to high-quality, self-paced e-learning content.

Explore Category
  • Acknowledgement
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, OPM3 and the PMI ATP seal are the registered marks of the Project Management Institute, Inc.
  • *All trademarks are the property of their respective owners and their inclusion does not imply endorsement or affiliation.
  • Career Impact Results vary based on experience and numerous factors.