previous | start | next

while Statement

while (condition)
   statement;


repeats the statement while the condition is true

while (balance < targetBalance)
{
   year++;
   double interest = balance * rate / 100;
   balance = balance + interest;
}


previous | start | next