Project

General

Profile

Actions

Bug #13977

closed

0 should be treated as FALSE

Added by Anon92929 (Anon Ymous) over 6 years ago. Updated over 6 years ago.

Status:
Rejected
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) over 6 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.

Actions

Also available in: Atom PDF

Like0
Like0