previous | start | next

## Nested Branches

- Nested `if/else` statements can be used when there are two (or more) levels of decision making.
- Example: Taxes
  - There is a different table for each marital status (decision 1).
  - Once you have found the right table, your are taxed differently according to your income (decision 2).

- > If your status is Single and if the taxable income is over | but not over | the tax is | of the amount over
  > $0 | $21,450 | 15% | $0
  > $21,450 | $51,900 | $3,217.50 + 28% | $21,450
  > $51,900 |  | $11,743 + 31% | $51,900

  > If your status is Married and if the taxable income is over | but not over | the tax is | of the amount over
  > $0 | $35,800 | 15% | $0
  > $35,800 | $86,500 | $5,370.00 + 28% | $35,800
  > $86,500 |  | $19,566.00+ 31% | $86,500

previous | start | next