If inside a for
/* Learning C# by Jesse Liberty Publisher: O'Reilly ISBN: 0596003765 */ using System; public class ForIfTester { public static void Main() { for (int counter=0; counter<10; counter++) { Console.WriteLine( "counter: {0} ", counter); // if condition is met, break out. if (counter == 5) { Console.WriteLine("Breaking out of the loop"); break; } } Console.WriteLine("For loop ended"); } }