Use continue to jump to the next around of loop in CSharp

Description

The following code shows how to use continue to jump to the next around of loop.

Example


 //  ww  w .j  a  v  a2 s.c om
using System; 
 
public class MainClass {     
  public static void Main() { 
    // print even numbers between 0 and 100 
    for(int i = 0; i <= 100; i++) {  
      if((i%2) != 0) continue; // iterate 
      Console.WriteLine(i); 
    } 
  }   
}

The code above generates the following result.





















Home »
  C# Tutorial »
    C# Language »




C# Hello World
C# Operators
C# Statements
C# Exception