Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Narishma
· 2mo ago · 0 comments
Didn't you just shift the branch to the calculateDiscount() function?
Comments
[–]
lscharen
2mo ago
No, because the point is that the branch version does not touch "total" when the branch is taken, but the non-branch version will
always
multiply "total" by
something
.
[–]
1718627440
2mo ago
Not necessarily.
return 1 - user.isPremiumMember * 0.1;
would also cut it.