Hacker News new | ask | show | jobs
by transreal 2530 days ago
I see this in professional work. The former reads more like English, and so there feels like there is an argument to be made that it is more readable, and also an argument that "the compiler will optimize it for you anyway".
2 comments

Are they wrong? To me, the long version is valid precisely because it is explicit (more to me than the short version), and will be optimized
and you question yourself if it was better to pack that readability into a function or not.

Also why would anyone store a boolean named isDone rather than just returning it as the contract of the function