From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2001-12-09T17:58:09+09:00 Subject: [ruby-talk:28011] Re: why doesn't zero evaluate to false? In article <013501c1804a$45a39c10$6401a8c0@mojave>, Issac wrote: >Does it cost more to test whether a FixNum is zero than >it does to test whether an object's type is NilClass or >FalseClass? I don't think it was an issue of runtime cost (I could be wrong) - but more an issue of designing the language such that the only values that evaluate to false are false (or FalseClass objects) and nil (NilClass). It's more an issue of consistency - 0 is a FixNum, so why should it be a special case that evaluates to false?. When you're coming from another language like C or Perl where 0 is a false condition, it can take a little while to get used to the Ruby way - but after you get used to Ruby's rule for determining truth, it seems to make sense. The rule is simple: the only things that evaluate to false are false and nil, everything else is true. Phil