Guest User

Untitled

a guest
May 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. def fav_destinations
  2. destination_array = [] # instead of the brackets, you can also use Array.new to make a new empty array
  3. 1.times do
  4. puts "Name a favorite travel destinantion."
  5. destination_array << gets.chomp
  6. end
  7. p destination_array
  8. puts "Your favorite travel destination is #{destination_array.join(", ")}."
  9. destination_array.each do |destination| # do something to each element in destination_array; that element is to be referred to as food
  10. puts "Travelling is so much fun! I like #{destination} too!" # the thing we are doing
  11. end # ends the loop
  12. end
  13. fav_destinations
  14.  
  15. def fav_foods
  16. food_array = [] # instead of the brackets, you can also use Array.new to make a new empty array
  17. 1.times do
  18. puts "Name a favorite food."
  19. food_array << gets.chomp
  20. end
  21. p food_array
  22. puts "Your favorite food is #{food_array.join(", ")}."
  23. food_array.each do |food| # do something to each element in food_array; that element is to be referred to as food
  24. puts "Who does not like food? I like #{food} too!" # the thing we are doing
  25. end # ends the loop
  26. end
  27. fav_foods
  28.  
  29. def fav_hobbys
  30. hobby_array = [] # instead of the brackets, you can also use Array.new to make a new empty array
  31. 1.times do
  32. puts "Name a favorite Hobby."
  33. hobby_array << gets.chomp
  34. end
  35. p hobby_array
  36. puts "Your favorite hobby is #{hobby_array.join(", ")}."
  37. hobby_array.each do |hobby| # do something to each element in hobby_array; that element is to be referred to as food
  38. puts "You can never have enough hobbies! I like #{hobby} too!" # the thing we are doing
  39. end # ends the loop
  40. end
  41. fav_hobbys
  42.  
  43. def fav_colors
  44. color_array = [] # instead of the brackets, you can also use Array.new to make a new empty array
  45. 1.times do
  46. puts "Name a favorite color."
  47. color_array << gets.chomp
  48. end
  49. p color_array
  50. puts "Your favorite color is #{color_array.join(", ")}."
  51. color_array.each do |color| # do something to each element in color_array; that element is to be referred to as food
  52. puts "Interesting,I like #{color} too!" # the thing we are doing
  53. end # ends the loop
  54. end
  55. fav_colors
  56.  
  57. def fav_songs
  58. song_array = [] # instead of the brackets, you can also use Array.new to make a new empty array
  59. 1.times do
  60. puts "Name a favorite Song."
  61. song_array << gets.chomp
  62. end
  63. p song_array
  64. puts "Your favorite song is #{song_array.join(", ")}."
  65. song_array.each do |song| # do something to each element in song_array; that element is to be referred to as food
  66. puts "Good to know, there are so many great songs! I like #{song} too!" # the thing we are doing
  67. end # ends the loop
  68. end
  69. fav_songs
  70.  
  71. def fav_movies
  72. movie_array = [] # instead of the brackets, you can also use Array.new to make a new empty array
  73. 1.times do
  74. puts "Name a favorite Movie."
  75. movie_array << gets.chomp
  76. end
  77. p movie_array
  78. puts "Your favorite movie is #{movie_array.join(", ")}."
  79. movie_array.each do |movie| # do something to each element in movie_array; that element is to be referred to as food
  80. puts "Movies are so great! I like #{movie} too!" # the thing we are doing
  81. end # ends the loop
  82. end
  83. fav_movies
Add Comment
Please, Sign In to add comment