break statement in C#
break Causes the loop to end immediately .
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) { if (i == 6) break; // break the loop when 6 encountered Console.WriteLine("{0}", i++); } Console.Read(); } } }