From: Mark Slagell Date: 2001-08-24T06:50:16+09:00 Subject: [ruby-talk:20211] Re: In Ruby 0 is true but nil is false.. or how to shoot yourself?.. > I think that this lack of consistency (you may take the truth value for > something which can be "nil", not for something which can be "0" or an > empty string) is likely to shoot the "principle of least surprise" that > Matz likes ;p. And actually it shot me; and I find the upper solution not > very pretty... By "inconsistency", do you mean with other languages? The rule on what-is-truth is simple in Ruby: nil and false are the only false things. Ruby is consistent on that rule, (which to those of us who are used to it) makes a whole lot of sense. Granted, it's a gotcha when you don't know about it, or are "thinking in" some other language.