Tuesday, December 17, 2013

While loop

This loop will repeat action until it is true.
Syntax:

while(condition)
{
  //code
}

Example:

int i=10;
while(i > 0)
{
  i=i-1;
}

This loop will continue substracting '1' from i, until i > 10.

No comments:

Post a Comment