while Loop in C#
while loops are very similar to do loops, but they have one important difference: The Boolean test in a while loop takes place at the start of the loop cycle, not the end. If the test evaluates to false , then the loop cycle is never executed. Instead, program execution jumps straight to the code following the loop.
Example
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int i = 1; while (i <= 10) { Console.WriteLine("{0}", i++); } Console.Read(); } } }