Actions
Bug #13977
closed0 should be treated as FALSE
Description
0 is false, 1 is true.
It is beyond stupidity that this even needs to be addressed. Fix this please.
Actions
Like0
Like0
Added by Anon92929 (Anon Ymous) over 7 years ago. Updated over 7 years ago.
Description
0 is false, 1 is true.
It is beyond stupidity that this even needs to be addressed. Fix this please.
Anon92929 (Anon Ymous) wrote:
0 is false, 1 is true.
Every programming language has its own convention. For example, in shell programming, 0 is true, and 1 (and any other numeric values except 0) are false.
In Ruby, only false
and nil
are "falsey". All other values (including 0, 0.0, Rational, BigDecimal, and Complex 0, empty Arrays, Hashes, Sets, and so on) are "truthy". The reason for this is that it's easy to remember. Remembering it is a step to becoming a Rubyist.