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/* ww w  .  j ava 2 s.  c o  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