C++ keyword: break
From cppreference.com
[edit] Usage
-
break
statement: as the declaration of the statement
[edit] Example
Run this code
#include <iostream> int main() noexcept { for (int i{0}; i < 69; ++i) { if (i == 3) [[unlikely]] break; // breaks from the 'for' loop std::cout << i; } }
Output:
012
[edit] See also
|
(since C++17) |
|
(since C++23) |
- switch statement:
switch
,case
- default (as case label declaration) etc:
default
- goto statement:
goto
- continue statement:
continue
(since C++20) |
- do-while loop and
while
loop:do
,while
- for loop and range-based
for
loop:for