Check out example codes for "while loop c#". It will help you in understanding the concepts better.

Code Example 1

int i = 0;

while (i < 10)
{
    Console.WriteLine("Value of i: {0}", i);

    i++;
}

Code Example 2

// To forcibly exit a while loop use 'break'
while (true)
{
	// Do something
  
	if (conditional)
    {
    	break;
  	}
}

Code Example 3

int i = 0;
while (i < 5) 
{
  Console.WriteLine(i);
  i++;
}

Code Example 4

int n = 0;
while (n < 5)
{
    Console.WriteLine(n);
    n++;
}

Learn ReactJs, React Native from akashmittal.com