Зміст курсу
C++ Loops
C++ Loops
Break 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.
Дякуємо за ваш відгук!