break statement in C#
For Example: Program to
demonstrate use of the break statement.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
classProgram
{
staticvoid Main(string[] args)
{
int i;
for (i = 1; i <= 10; i++)
{
if (i > 5)
break;
Console.WriteLine(" {0}", i);
}
Console.ReadLine();
}
}
}
Output:
Comments
Post a Comment