Advertisement
urbanslug

Best if statement

Nov 10th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. # example 1
  2. def love_me?("reply")
  3. "She does" if reply == "yes"
  4. "No bro" if reply != "yes"
  5. end
  6.  
  7. # example 2
  8. def love_me?("reply")
  9. if reply == "yes"
  10. "She does"
  11. else
  12. "No bro"
  13. end
  14.  
  15.  
  16. In the above what is returned is the result of the if statement. I like the brevity of example 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement