While Loop in C#

0
68
while loop
while loop

The while loop will check a condition and then continue to execute block of code as long as the condition  evaluates to a Boolean value of true. Its  syntax is as follow: while (<Boolean expression>) {<statement>} .The statements can be any valid in C# statements the Boolean expression is evaluate before any code in the following block has executed.

 

EXP –

 

Class While Loop

{

Public static void main ()

{

Int myInt  = 0;

While (my Int<10)

{

Console Write “{0}”,myint);

myInt++;

}

Console Write Line ();

}

}



LEAVE A REPLY

Please enter your comment!
Please enter your name here