Thanks to all who responded to my query. Ruby is so magnificent, I would never dream of suggesting a change, because, ultimately, it would probably somehow hose the principal of least surprise that makes it so great. Thanks again, JJ On 20-Apr-2006, at 04:26, Peter Ertl wrote: > Most common is 0 := false, 1 := true as you already know. > I think in Visual Basic it is 0 := false, -1 := true > Also possible 0 := false, not 0 := true > > So it depends ... :-) > > > >> --- Ursprgliche Nachricht --- >> Von: Xavier Noria <fxn / hashref.com> >> An: ruby-talk / ruby-lang.org (ruby-talk ML) >> Betreff: Re: Zero is true, but it isn't >> Datum: Thu, 20 Apr 2006 16:26:09 +0900 >> >> On Apr 20, 2006, at 1:51, John Johnson wrote: >> >>> I was wondering today, so I tried this: >>> >>> puts "It's true" if 0 >>> >>> Which prints "It's true", meaning 0 is not false. (This should >>> surprise C/C++/etc. people). >>> >>> So that means >>> puts "It's equal" if 0 == true >> >> You are seeing a particular case of the fact that the boolean >> interpretation an object may be different from the object value >> itself. And == is comparing object values, not boolean >> interpretations. Then the result of == is interpreted in boolean >> context, but by then 0 was seen as an integer already, which is >> certainly different from the object true. >> >> To make it apparent take "foo". The string "foo" is true in boolean >> context, but it won't surprise you to realise that "foo" == true does >> not hold. >> >> -- fxn >> >> > > --- Help everyone. If you can't do that, then at least be nice.