2 ms·
I'd think most people would remember * before + from school math, but for other operators the precedence is kind of arbitrary (can vary between languages) and a
by klipt 7y ago
I'd think most people would remember * before + from school math, but for other operators the precedence is kind of arbitrary (can vary between languages) and adding parentheses to make it less ambiguous and more readable doesn't seem like the worst idea.
- mailslot 7y agoYes, it can vary, but it’s kind of important. If you don’t know the order of specific operators, or if your language violates math rules, a dev might want to know that instead of resigning to just not know things. For readability, yes... sometimes, but for readability sake, not “I don’t know what this does without them.” I’m not just talking about math operators, but logical ones too. I’ve seen people put parens around every “not” because they weren’t sure. There are three essential logical operators. Surely those can be learned at least. And yes... in those cases where readability is an issue, of if they’re necessary, please do add them, but please don’t if you’re unsure what “!a && b || c” does. Seeing “((!a) && b) || c” raises red flags.