Hi -- On Thu, 20 Apr 2006, 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 > > but 0 != true. Although it seems it should be, since 0 != false as well. So, > by extension, if an object is not nil, and it is not equal to false, then it > would stand to reason that it is equal to true. > > Any thoughts? Every object has a Boolean value of true or false, separately from the fact that there are objects called true and false. The objects false and nil have a Boolean value of false; all other objects have a Boolean value of true (including true, integers, strings, etc.). The result is that passing the "if x" test, on the one hand, and being the object true, on the other, are not the same thing. David -- David A. Black (dblack / wobblini.net) Ruby Power and Light, LLC (http://www.rubypowerandlight.com) "Ruby for Rails" PDF now on sale! http://www.manning.com/black Paper version coming in early May!