continue statement forgoes the remaining statements in a loop and makes an early start on the next iteration. - CSharp Language Basics

CSharp examples for Language Basics:continue

Introduction

The following loop skips even numbers:

Demo Code

using System;/* ww w.j a v a 2s  .  c  o m*/
class Test
{
   static void Main(){
      for (int i = 0; i < 10; i++)
      {
         if ((i % 2) == 0)       // If i is even,
            continue;             // continue with next iteration
         Console.Write (i + " ");
      }
   }
}

Result


Related Tutorials