How to use do-while loop statement in C#?

Below code shows how to use do-while loop statement in csharp/C# –

using System;

namespace kodehelp.csharp.basic
{
    class DoWhileLoop
    {
        public static void Main(string[] args)
        {
            int i = 0; // initialize an int variable

            //
            // iterate the loop while the value of i is still less 
            // than 10.
            //
            do
            {
                Console.WriteLine(i);
                i++; // increment the value of i
            } while (i < 10); 

            Console.ReadLine();
        }
    }
}

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.