Do While Loop C++

The Do/While Loop

The do/while loop is a variation of the while loop. This circle will execute the code block once, prior to checking on the off chance that the condition is valid, at that point it will rehash the circle as long as the condition is valid.


do {
  // code block to be executed
while (condition);

The model underneath utilizes a do/while loop. The circle will consistently be executed at any rate once, regardless of whether the condition is bogus, in light of the fact that the code block is executed before the condition is tried:


int i = 0;
do {
cout << i << “\n”;
while (i < 5);