previous | start | next

## Simple Loops

- A loop is a block of code that can be performed repeatedly.
- A loop is controlled by a condition that is checked each time through the loop.
- The `while` statement makes a check before each execution of the code.

  >     /* how long does it take an investment to double? */

  >     while( balance < 2 * initial_balance)
  >     {
  >        balance = balance * ( 1 + rate / 100);
  >        year++;
  >     }

previous | start | next