Ключевое слово C++: do
Использование
-
do-whileцикл: объявление цикла
Пример
#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);
}
Вывод:
123
См. также
| (начиная с C++17) |
| (начиная с C++23) |
-
switchоператор:switch,case -
default(как объявление метки case) и т. д.:default -
gotoоператор:goto -
continueоператор:continue -
breakоператор:break -
returnоператор:return
| (начиная с C++20) |
-
do-whileцикл и циклwhile:while -
forцикл и циклforс диапазоном:for
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/keyword/do