Continue Statement in C#

Bageshkumarbagi
Posted by Bageshkumarbagi under C# category on | Points: 40 | Views : 1113
public static void Main()
{

int total = 0;

for (int i = 1; i <= 10; i++)
{
if (i == 6)
{
System.Console.WriteLine("continue from loop start");
continue;
}
System.Console.WriteLine("i = " + i);
total += i;
}

System.Console.WriteLine("total = " + total);

}

Comments or Responses

Login to post response