Project

General

Profile

Bug #13977

0 should be treated as FALSE

Added by Anon92929 (Anon Ymous) almost 3 years ago. Updated almost 3 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:83122]

Description

0 is false, 1 is true.

It is beyond stupidity that this even needs to be addressed. Fix this please.

Updated by duerst (Martin Dürst) almost 3 years ago

  • Status changed from Open to Rejected

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.

Also available in: Atom PDF