added a small statement (#23119)
* added a small statement * Fixed formatting
This commit is contained in:
committed by
Manish Giri
parent
3ba002f2b6
commit
d8861ab98a
@ -2,8 +2,9 @@
|
|||||||
title: do while loop
|
title: do while loop
|
||||||
---
|
---
|
||||||
## Do While Loop
|
## Do While Loop
|
||||||
|
This is just like the `while` and `for` loop but the only difference is that the code in its body is executed once before checking the condition.
|
||||||
|
|
||||||
The `do while loop` is almost the same as the while loop. The `do while loop` has the following form:
|
The `do while` loop has the following form:
|
||||||
```cpp
|
```cpp
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -20,6 +21,8 @@ The do-while loop is used whenever you are sure that a particular process(within
|
|||||||
|
|
||||||
Do something first and then test if we have to continue. The result is that the do block runs at least once. (Because the expression test comes afterward) . Take a look at an example:
|
Do something first and then test if we have to continue. The result is that the do block runs at least once. (Because the expression test comes afterward) . Take a look at an example:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
Reference in New Issue
Block a user