.NET Fiddle

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		for (var i = 0; i < 10; i++)
		{
			if (i >= 5)
			{
				break;
			}
			Console.WriteLine("This will appear only 5 times, as the break will stop the loop.");
		}
	}
}
;