4 ms·
Avoid puzzles in code
- jbrooksuk 14y agoI see these all the times, that and "How many squares are there in this picture?". Does my nut in, but it's quite surprising to read the comments and see how many people get it wrong. I myself, am not anywhere near good at maths, I know what I need, but that's it, I didn't do too well at my exams either, but am able to do my job as a developer and yet people who you'd think need maths more are getting these questions wrong. It seems programming really helps with understanding the "grammar" the term I use lightly, to read these equations.
- visualcsharp 14y agoI use extra parentheses to communicate my intent to other developers. A developer might know that 6/2(1+2)=9 but they could be thinking "did the original coder /intend/ to do (6/2) or 6/(2(1+2))?" I like things to be unambiguous WRT math in my code.