Leave parts of the for to be empty in CSharp

Description

The following code shows how to leave parts of the for to be empty.

Example


using System; /*w  w w.  jav a  2 s  .c o m*/
 
public class MainClass {   
  public static void Main() { 
    int i; 
 
    for(i = 0; i < 10; ) { 
      Console.WriteLine("Pass #" + i); 
      i++; // increment loop control var 
    } 
  }   
}

The code above generates the following result.





















Home »
  C# Tutorial »
    C# Language »




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