DEV Community

Mahamadjon000
Mahamadjon000

Posted on

1

do while

do while - это цикл который выполняет код хотя бы один раз если условие окажется false. Потом он продолжает повторятся пока условие окажется true.

Нужно оброшать внимание на ; после условия - она обязательна!

Пример кода:

#include <iosream>

using namespace std;

int main()
{

int number = 10;

do
{
cout << "Number" << number << endl;

}while(number < 5)

return 0;
}
Enter fullscreen mode Exit fullscreen mode

Обьяснение кода:

Это программа выведет Number 10 один раз несмотря на то что условие number < 5 false.

Top comments (0)

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay