News for hackers. Stuff that matters.
Re:Dev Fonts by rplnt on Friday November 20, 2020 @12:20PM (#25162577)
Not for comparison, but for boolean checks I prefer to use `foo == false` instead of `!foo`, the latter is easy to overlook.
Re:Dev Fonts by franga2000 on Friday November 20, 2020 @02:49PM (#25164166)
I've recently started using a kind of middle ground by putting spaces around the !. Makes it harder to miss without losing the "reads like text" property that's lost when using == false.

if ( ! isLast(e) ) reads perfectly, especially since my native language doesn't insert the "not" im the middle like english does and my brain is used to that. if (isLast(e) == false) just jolts me out of that state where code reads as fluently as text. YMMV, of course, and I have a suspicion that your native language might play a role in that...

Re:Dev Fonts by dylan604 on Friday November 20, 2020 @02:33PM (#25163981)
Do all languages have `foo === false`? When testing booleans, I always do the type specific test to avoid `foo = 0 !== false` stuff
Re:Dev Fonts by Jenz on Friday November 20, 2020 @07:31PM (#25166804)
> Do all languages have ...

Of course not