Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Break and Continue Keywords | While Loop
C++ Loops
course content

Course Content

C++ Loops

C++ Loops

1. While Loop
2. For loop
3. Nested loops

bookBreak and Continue Keywords

There are two keywords that allow for more flexible work with loops: break and continue. They are control flow statements used within the loops to alter their behavior.

Continue

When the continue keyword is encountered within a loop, it immediately transfers control to the next iteration of the loop, skipping the remaining statements within the current iteration. In other words, it allows you to skip the current iteration of the loop and proceed with the next iteration.

Break

When the break keyword is encountered within a loop, it immediately transfers control out of the loop, effectively ending the loop prematurely. In other words, it allows you to exit the loop before it would normally complete all its iterations, skipping any remaining iterations and the statements within them.

1. What does the break keyword do when encountered within a loop?
2. What does the continue keyword do when encountered within a loop?
What does the break keyword do when encountered within a loop?

What does the break keyword do when encountered within a loop?

Select the correct answer

What does the continue keyword do when encountered within a loop?

What does the continue keyword do when encountered within a loop?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 4
some-alt