From: Zach Dennis Date: 2004-11-02T02:51:19+09:00 Subject: Re: Another scrach on head Mohammad Khan wrote: >On Sat, 2004-10-30 at 00:03, Yukihiro Matsumoto wrote: > > >>Hi, >> >>In message "Re: Another scrach on head" >> on Sat, 30 Oct 2004 03:38:43 +0900, Jamis Buck writes: >> >>|No, I mispoke for the sake of simplification. nil and false _evaluate to >>|false_ in a boolean context, and everything else evaluates to _true_ in >>|a boolean context. >> >>Ruby never get passed on telephone test. >> >>"In Ruby, nil and false are false, but nil is not false, because false >>does not equal to nil.." >> >> matz. >> >> > >Hi Matz, > >Thanks for your reply. >What about 'true'? > >My point was, > >a = Whatever.new # other than NilClass or FalseClass > >if a > # block 1 >end > >if a == true > # block 2 >end > >block 1 and block 2 will be executed only when a.class is TrueClass. > > > This is not true, block 1 will execute if *a* is anything but nil or false. a = "a string" puts "a evaluates to true" if a or if a then puts "a evalutes to true" end Zach