C++ keyword: break
From cppreference.com
Usage
breakstatement: as the declaration of the statement
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
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
whileloop:do,while - for loop and range-based
forloop:for