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

Break and Continue KeywordsBreak 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 continue keyword do when encountered within a loop?

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

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

Секція 1. Розділ 4
course content

Зміст курсу

C++ Loops

Break and Continue KeywordsBreak 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 continue keyword do when encountered within a loop?

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

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

Секція 1. Розділ 4
some-alt