Your Ad Here

Posted By

kungfoo on 05/12/09


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

webstic


Redundant boolean logic 1.0


 / Published in: Ruby
 

WTF!

  1. if (!check_part(baz)) then
  2. # do something
  3. end
  4.  
  5. def check_part(foo)
  6. if (foo) then
  7. return true
  8. else
  9. return false
  10. end
  11. end
  12.  
  13.  
  14. # why not just write this:
  15. unless baz
  16. # do something
  17. end

Report this snippet  

You need to login to post a comment.