by gruez · 9y ago · 0 comments
which only applies if you're writing code for yourself. you can't expect everyone to know that idiom. same with using the + operator to cast to number, or an extreme case, the tadpole operator https://blogs.msdn.microsoft.com/oldnewthing/20150525-00/?p=...
Code should be written so that it is understandable by other professional programmers, not people who started programming two weeks ago.
People who only start coding for two weeks can't understand any code.
People who start has enough experience to work, but only start in this project for two weeks, will understand "!!" idiom.
The '!!expr' is the idiom most people use whenever the need for a canonical 0/1 representation arises.