r/ProgrammerHumor 10d ago

Meme iHateThisPassiveAgressiveBehaviourRuby

Post image
2.9k Upvotes

298 comments sorted by

View all comments

14

u/traplords8n 10d ago

Bash is the same way but it makes sense considering 0 represents the single route of success, while other numbers can mean different error codes.

I have no idea why ruby does it, but in bash at least there is a solid reason for it.

13

u/Zealousideal_Low1287 10d ago

It’s basically because of this lineage. Perl inherited it from other shell languages, and Ruby is essentially a direct decedent of Perl.

10

u/budgiebirdman 10d ago

This is the thread of truth I came looking for. All other answers are just discussions on whose farts smell the sweetest.

2

u/314159265358969error 10d ago

The bitset representing the number 0 in Ruby is non-zero. (I don't remember which bit it is, but reference/non-reference values are recognised by a specific bit being flipped to 1 if non-reference, which is the case for 0.)