While loop
The while loop includes a
Boolean expression as a condition which will return true or false. It executes
the code block, as long as the specified conditional expression returns true
Syntax:-
|
while ( expression )
{
statements;
}
|
Example of while loop:-
|
class
whileLoopExampleProgram
{
static
void Main ( string[ ] args )
{
int
i;
i
= 1;
while
( i<50 )
{
Console.WriteLine(“current
Value of the i variable is :”+ i );
i
= i+5;
}
Console.Read();
}
}
|