From: Zach Dennis Date: 2004-10-30T03:07:35+09:00 Subject: Re: Another scrach on head Mohammad Khan wrote: >if (expression) > block # 1 >end > >block # 1 would be executed if expression is true. > >Watch this, >a = 5 > ># 2 >if (a) > block # 2 >end > ># 3 >if (true) > block # 3 >end > ># 4 >if (a == true) > block # 4 >end > ># 5 >if (a.class == TrueClass) > block # 5 >end > ># 6 >if (not a.nil?) > block # 6 >end > >Ofcource, block # 4 and #5 would not execute. >Why would block # 2 ? > > Everything in ruby except for false and nil return true in a boolean expression. >So, isn't #6 more logical than #2. > > #2 is more reader friendly at a quick glance and it is faster to type then #6. >Didn't we wanted to mean #6 when we wrote #2 > > #2 and #6 will always evaluate to the same result. Zach