CSharp – while Statement


using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int number = 0;

            while(number < 5)
            {
                Console.WriteLine(number);
                number = number + 1;
            }

	    // the console will close if you press Return on the keyboard
            Console.ReadLine();
        }
    }
}

The result is:
0
1
2
3
4