Commit 1d35714
committed
Clarify order of operations in totalPrice calculation
The code change in the `HandleBurgersAsync` method of the `CafeController`
class modifies the calculation of the `totalPrice` variable. The original
calculation `burgers * burgerPrice + (drink ? drinkPrice : 0)` has been
updated to include parentheses around the burger price calculation:
`(burgers * burgerPrice) + (drink ? drinkPrice : 0)`. This change ensures
that the multiplication operation is explicitly prioritized over the
addition operation, although the original code would have worked correctly
due to operator precedence rules.
This change improves code readability and reduces potential misunderstandings
regarding the intended calculation.1 parent fbff5de commit 1d35714
1 file changed
Lines changed: 1 addition & 1 deletion
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
0 commit comments