Re:Amazon to display tariff costs for consumers
by unwind on Tuesday April 29, 2025 @07:59AM
(#43831385)
Please don't use if:s to assign boolean literals, just do it:
also saves you from not initializing the variable in the default/other case. :)
[ Parent
| on HN ]
Re:Amazon to display tariff costs for consumers
by Upvoter33 on Tuesday April 29, 2025 @08:25AM
(#43831662)
This was just someone showing you what the "Amazon programmer" was doing, and hence a deep cut reference to the likelihood of it being poor quality code :)
Re:Amazon to display tariff costs for consumers
by TheSoftwareGuy on Tuesday April 29, 2025 @09:07AM
(#43832065)
If you really wanted to look like Amazon codex you would write Java :)
Re:Amazon to display tariff costs for consumers
by maxvisser on Tuesday April 29, 2025 @12:34PM
(#43834860)
I see I missed an opportunity to make it even funnier.
Re:Amazon to display tariff costs for consumers
by Someone on Tuesday April 29, 2025 @08:28AM
(#43831686)
In the original code, trump_tariff is a sticky value. If that’s intended/not intended, the above introduces/fixes a bug.
Re:Amazon to display tariff costs for consumers
by throwaway519 on Tuesday April 29, 2025 @08:31AM
(#43831721)
const
I feel you may underestimate how often they change.
Re:Amazon to display tariff costs for consumers
by grokkedit on Tuesday April 29, 2025 @08:41AM
(#43831813)
not to mention the mix of snake_case & camelCase
Re:Amazon to display tariff costs for consumers
by ImHereToVote on Tuesday April 29, 2025 @09:00AM
(#43831989)
If statements are great because they are highly readable.