From: Hongli Lai Date: 2008-08-24T18:23:04+09:00 Subject: Re: Why 'if 0' succeeds in Ruby Dave Bass wrote: > But unfortunately Ruby regards both false and nil as not-true. For some > reason, this is touted as a feature. > > False and nil are two quite different concepts and should not be > conflated. I've found that treating both nil and false as false to be the correct behavior for most of my code. I've rarely written code where I *don't* want nil to be treated as false. Furthermore, in by far most of the use cases, I don't want to treat 0 as false. In other languages, such as Perl, I end up having to write 'if (!defined($foo) || $foo eq "0")' all the time. So I like Ruby's behavior. Treating both nil and false as false covers most of the use cases. -- Posted via http://www.ruby-forum.com/.