C# program for Break Statement




This is the simple and the best example for the Break Statement.

Here, we can see how to implement the Break Statement in the program.

Break Statement is mainly use to terminate the flow of the program and we can also set the next execution and the controls can be give to that execution with the help of this.



ENJOY CODING!!!
___________________________________________________________________________________


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Break_Statement
{
    class PostSlush
    {
        static void Main(string[] args)
        {
            int a = 0;

            while (a < 100)
            {
                Console.WriteLine(a);
                if (a == 10)
                {
                    Console.WriteLine("Breaking the Current Segment....");
                    break;
                }
                a++;
            }
            Console.ReadLine();
        }
    }
}


Output :

 
Previous Post Next Post