Advertisement
Guest User

Untitled

a guest
Feb 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. def choose
  2. puts "Do you like programming? Yes or no please."
  3. choice = gets.chomp
  4. if (choice.downcase == "yes")
  5. puts "That\'s great!"
  6. elsif (choice.downcase == "no")
  7. puts "That\'s too bad!"
  8. else
  9. puts "That wasn\'t a yes or no."
  10. end
  11. end
  12. choose
  13.  
  14. #Here Starts the 2nd part of the Excercise#
  15.  
  16. def choose
  17. puts "Do you like programming? Yes, no, or maybe please."
  18. choice = gets.chomp
  19. case choice.downcase
  20. when "yes"
  21. puts "That\'s great!"
  22. when "no"
  23. puts "That\'s too bad!"
  24. when "maybe"
  25. puts "Glad you are giving it a chance!"
  26. else
  27. puts "I have no idea what that means."
  28. end
  29. end
  30. choose
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement