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

Зміст курсу

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?

Виберіть правильну відповідь

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

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

Виберіть правильну відповідь

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 1. Розділ 4
We're sorry to hear that something went wrong. What happened?
some-alt