Rewrite exercise 1 in chapter 2
Closed this issue · 5 comments
rescript-tutorial/src/chap_2_functional.res
Lines 34 to 45 in 7485e1f
Rewrite the exercise copy to improve readability & comprehension.
The part where the 5% discount has to be applied has issues. It is easy to miss out on the fact that the calculation involves deducting the cart total amount from 200, before applying a 5% discount.
@jcsherin
Also, what is "add 25 to, " on line 43 suppose to mean?
@ForgottenProgramme When the value is 200 >= & <500
discount = (value - 200 * 0.05) + 25
So for 499
discount = ( 499 - 200 * 0.05 ) + 25 = 39
- When the total is either 200 or above, but below 500:
- add 25 to,
- a 5% discount on the amount greater than 200
I think, we can change this to:
- When the total is either 200 or above, but below 500:
- 5% discount on the amount greater than 200, plus 25. That is, discount = (total-200) * 0.05 + 25 .
@ForgottenProgramme I've made a draft-PR. Please take a look and see if any other changes are required.
@jcsherin , Okay.