The break statement is used to terminating the running statement of program and transfer controls to the next execution.

Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Break_Statements_Example
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 0;
            while (i < 100)
            {
                Console.WriteLine(i);
                if (i == 20)
                {
                    Console.WriteLine("Breaking the current Statement...");
                    break;
                }
                i++;
            }
            Console.ReadLine();
        }
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *