SEARCH C# PROGRAMMING CODES HERE

While loop

While Loop in C#
While loop simply executes a block of code as long as the condition you give is true. First, it tests the condition before executing the loop body.
Example as follows.

using System;
namespace while_loops
{
    class Program
    {
        static void Main(string[] args)
         {
            /* local variable definition */
         int i = 1;

         /* while_loops execution */
         while (i < 10)
        {
            Console.WriteLine("value of i = {0}", i);
            i++;
         }
         Console.ReadLine();
      
         }
      }
    }


Output
value of i = 1
value of i = 2
value of i = 3
value of i = 4
value of i = 5
value of i = 6
value of i = 7
value of i = 8
value of i = 9