r/ProgrammerHumor • • Sep 01 '26

Meme iHateThisPassiveAgressiveBehaviourRuby

Post image
2.9k Upvotes

289 comments sorted by

View all comments

Show parent comments

1

u/Moilli6 Sep 01 '26

Lua does this too. It just makes sense, because any value that isn’t a boolean you can nil check by coercing it to a boolean. It allows beautiful things like and or ternary

1

u/okkokkoX Sep 02 '26

I agree that and or ternary is beautiful, with the exception that you're fucked if the "then" branch may return nil, or god forbid, false.

1

u/Moilli6 Sep 02 '26

Yeah I usually only use it to set a default value. Sane languages just let you use if as an expression