2 ms·
It depends on what the set of falsey values is for that language. E.g. in Common Lisp, the only falsey value is NIL (the empty list). This is easy to understan
by lmkg 7y ago
It depends on what the set of falsey values is for that language.
E.g. in Common Lisp, the only falsey value is NIL (the empty list). This is easy to understand, easy to remember, and straightforward in practice because idiomatic Lisp does a lot of list operations. It wouldn't make sense for 0 to be truthy, because that's a legit value, and NIL represents the absence of a value.
I don't know what values are falsey in Ruby, so I can't comment on it.