Continue statement in C#
In this article I will explain how to use continue statement in C#.
Introduction
The continue statement is used to transfer the control to the next iteration of the enclosing iteration statement in which it appears. It jumps immediately to the next iteration in the loop. This keyword is most useful in while-loops. The form of continue statement is following
continue;
Example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Continue_Statement
{
class Program
{
static void Main(string[] args)
{
int i = 0;
while (i < 20)
{
i++;
if (i < 11)
{
continue;
}
Console.WriteLine(i);
}
Console.ReadLine();
}
}
}
The output of following program