CSharp - Statement break statement

Introduction

The break statement ends the execution of the body of an iteration or switch statement:

Demo

using System;
class MainClass//from   w  w w.  jav  a2  s.  c  om
{
   public static void Main(string[] args)
   {
         int x = 0;
         while (true)
         {
           Console.WriteLine("before break:"+x);
           if (x++ > 5)
             break ;      // break from the loop
           Console.WriteLine("after break:"+x);
         }
         Console.WriteLine("execution continues here after break");
   }
}

Result