Open/closed: discount rules

Add a new discount by adding a rule, without editing the code that computes prices.

Level Intermediate

What you will see

  1. Discounts keep coming
  2. The same switch, twice
  3. One question per discount
  4. A list instead of a switch
  5. When not to open

Before / after

Base: open-closed-base-tsView the diff

Exercises