Hacker News new | ask | show | jobs
by InAnEmergency 4852 days ago
That seems more confusing, since they evaluate to the same thing.

    1.9.3p392 :001 > true && 1
     => 1 
    1.9.3p392 :002 > true and 1
     => 1 
    1.9.3p392 :003 > false && 1
     => false 
    1.9.3p392 :004 > false and 1
     => false 
    1.9.3p392 :005 > nil && 1
     => nil 
    1.9.3p392 :006 > nil and 1
     => nil 
Which is why explicitly checking for "true" or "false" in a conditional is unusual.