CSharp - Statement continue statement

Introduction

continue statement stops the current loop and makes loop start on the next iteration.

The following loop skips even numbers:

Demo

using System;
class MainClass/* w  ww . j  ava 2  s  . co  m*/
{
   public static void Main(string[] args)
   {
         for (int i = 0; i < 10; i++)
         {
           if ((i % 2) == 0)       // If i is even,
             continue;             // continue with next iteration
    
           Console.Write (i + " ");
         }
   }
}

Result