tumblr tracker

While

Parent Previous Next

While keyword


Executes set of commands while the condition is true.


While (condition is true) {

//commands to execute

}


The brackets () enclosing the loop condition and the curly brackets {} enclosing the commands to execute are required. The curly bracket can also start on a line of its own.



Example


$cnt = 0;

While ($cnt < 10)
{
   MessageBox.ShowInfo("$cnt is " + $cnt);
   $cnt = $cnt + 1;
}