# do-while Loop

A loop that runs its body once before checking whether to repeat.

## What is **do-while Loop** in C#?

**do-while Loop** — A loop that runs its body once before checking whether to repeat.

```csharp
class Counter
{
    int CountToThree()
    {
        int number = 0;

        while (number < 3)
        {
            number++;
        }

        return number;
    }
}
```

Level: Apprentice · [More C# terms at this level](https://www.ask-codey.com/glossary/subjects/c-sharp/apprentice)

Updated: September 27, 2026

## In other subjects

- [do-while Loop in Java](https://www.ask-codey.com/glossary/do-while-loop)

Source: https://www.ask-codey.com/glossary/do-while-loop-c-sharp
