Control a do while loop with int value in CSharp

Description

The following code shows how to control a do while loop with int value.

Example


/*www.j a v a  2s  .  co  m*/
using System;

public class MainClass {     
    static void Main(string[] args)
    {
        int i = 5;

        do
        {
            Console.WriteLine(i);
            i--;
        } while (i > 0);

    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    C# Language »




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