Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Breaking out of an Iterative Statement in C#

This example uses the break statement to break out of a for loop when an integer counter reaches 10.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace ForgetCode
{
    class Program
    {
       static void Main(string[] args)
        {
            for (int counter = 1; counter <= 1000; counter++)
            {
                if (counter == 10)
                    break;
                Console.WriteLine(counter);
            }
           
        }
    }
}


Output:
1 to 9 will be printed. Rest of the numbers will be ignored since break was rendered.