Create a negatively running for loop in CSharp

Description

The following code shows how to create a negatively running for loop.

Example


using System; /*w ww .  j  ava  2s . co  m*/
 
public class MainClass {     
  public static void Main() {     
    int x; 
 
    for(x = 100; x > -100; x -= 5) 
      Console.WriteLine(x); 
  } 
}

The code above generates the following result.





















Home »
  C# Tutorial »
    C# Language »




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