while
loop statement uses a bool value to control a loop body.
The while
loop has the following form.
while(bool expression){
loop body
}
using System;
class Program
{
static void Main(string[] args)
{
int i = 5;
while (i > 0)
{
Console.WriteLine(i);
i--;
}
}
}
The output:
5
4
3
2
1
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |