Guest User

Untitled

a guest
Nov 20th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. def smiley(input)
  2. if input[:mood] == "happy" #mood is the key, it also has to be a string
  3. return ":)"
  4. elsif input[:mood] == "sad"
  5. return ":("
  6. else
  7. return ":|"
  8. end
  9. end
  10.  
  11.  
  12. h1 = {:mood => "happy"}
  13. h2 = {:mood => "sad"}
  14. h3 = {:mood => "sentimental"}
  15. puts smiley(h2)
Add Comment
Please, Sign In to add comment