C++ keyword: do
From cppreference.com
[edit] Usage
-
do-while
loop: as the declaration of the loop
[edit] Example
Run this code
#include <iostream> int main() noexcept { int i{0}; // executes statement 'std::cout << ++i;' // before checking the condition 'i <= 2' do std::cout << ++i; while (i <= 2); }
Output:
123
[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
- break statement:
break
- return statement:
return
(since C++20) |
- do-while loop and
while
loop:while
- for loop and range-based
for
loop:for