---
title: "Describe about do-while loop."  
description: "Describe about do-while loop."  
author: "Anonymous User"  
published: 2020-01-21  
updated: 2020-01-21  
canonical: https://www.mindstick.com/forum/155715/describe-about-do-while-loop  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Describe about do-while loop.

[Briefly explain](https://www.mindstick.com/forum/156854/briefly-explain-the-concept-of-constructor-overloading) me about do-while loop with its example.

## Replies

### Reply by Nishi Tiwari

Do-While statement is used to execute the block of statement until the condition is true.

It is similar to while loop but the only difference is that, in **[while loop the block of statement](https://www.mindstick.com/forum/155714/define-while-loop)** will execute only when the condition is true, but in do-while statement will execute at least once, because the body of statement will execute first then the condition is checked.

We use keyword do and while to create the body for do-while loop.

## Syntax

```
do
{
    //statement of body to execute
}while(condition);
```

## Example

```
using System;
namespace Do_While
 {
    class Program
    {
        static void Main(string[] args)
        {
            int i = 1;
            do
            {
                Console.WriteLine("i value: {0}", i);
                i++;
            } while (i <= 4);
            Console.WriteLine("Press Enter Key to Exit..");
            Console.ReadLine();
        }
    }
}
```

## Output:-

```
i value: 1 i value: 2
i value: 3
i value: 4
Press Enter Key to Exit..
```

![Describe about do-while loop.](https://www.mindstick.com/mindstickforums/37eecdcd-ca4e-452f-b502-b3663e6e8440/images/f0f940e3-f389-4e1f-89ed-8abe783ba6da.png) **\**

## \


---

Original Source: https://www.mindstick.com/forum/155715/describe-about-do-while-loop

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
