Updated on Kisan Patel
The do...while
loop statement is a post-test loop, which means it executes a statement first then checks if the condition is true. If the condition is true, the loop continues until the condition is false.
The basic structure of a do...while
loop is –
do { statement or block of code } while (condition);
Let’s take one example to understand do…while loop in C# programming language.
using System; namespace ConsoleApp { class dowhileloopDemo { static void Main(string[] args) { int i = 1; do { Console.WriteLine(i); i++; } while (i <= 10); } } }
The output of the above C# program…