this post was submitted on 19 Jul 2023
843 points (95.7% liked)
Memes
45643 readers
1307 users here now
Rules:
- Be civil and nice.
- Try not to excessively repost, as a rule of thumb, wait at least 2 months to do it if you have to.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I completely agree on this, and yes, this is what I always do, cuz... well, we're human, we make mistakes, parentheses makes things easily visible, thus cutting down on mistakes.
Still, I do know operation order, as a rule I mean. In simple calcs like these, making a mistake is almost impossible. Thus, people that answered 16 probably just don't know the order... that is something you learn in 1st, 2nd grade, it's not quantum mechanics we're talking about here.
We only do that cuz we're not sure how the compiler will interpret the operation order, and there's waaaay too many versions and different languages to actually remember how each of them interprets math operation order. So, we do a safe bet, put parentheses on everything. Hell, I do it as well, I just can't be bothered to remember if C interprets it like this, Python like that, Rust like... god knows what. They should, in theory, know math operation order, but let's face it, we all do it cuz we've been faced with bugs that are a direct result of the compiler not intepreting things as it should.
That being said, yes, I do agree that prentheses on everything, even math on paper, is the way to go. Plus, even people that don't know operation order, will learn it a lot qucker if you just show them how easy things become once you start using prentheses.