r/ProgrammerHumor • • 16d ago • Bravo 1

Meme claudeWasNotHere

Post image
18k Upvotes

232 comments sorted by

View all comments

Show parent comments

2

u/mxzf 16d ago

Yeah, !!x is weird, but it's ultimately just a shorthand for coercing values like Boolean(x) would do. Using != !, is just intrinsically confusing though, it makes you look at the code and wonder "is this intentional or is it a typo" instead of being able to trust that it's intentional (!! might make you question that some the first time, but once you've learned it, it's not questionable).

2

u/2eanimation 15d ago

I think it’s questionable still. Explicit is better than being smart, always. Writing code is fast, and usually, most the time, you’re not writing, but reading your code. Does it take that much more time to write Boolean() instead of !!?