Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ampers: Nicoleta Brandolini #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions randommenu.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# create three arrays

adjectives = ["sweet", "sour", "icky", "yummy", "salty", "crunchy", "gross", "pickled", "cold", "spicy"]
methods = ["fry", "roasted", "baked", "saute", "frozen", "smoked", "steamed", "toasted", "melted", "burned"]
foods = ["eggplant", "califlower", "squash", "tofu", "potato", "apples", "ice-cream", "chocolate", "beans", "mango"]

# version 1
# loop over arrays, print random menu items
# 10.times do |item|
# # Assign variables
# adjective = adjectives.sample
# method = methods.sample
# food = foods.sample
#
# puts "#{item + 1}. #{adjective} #{method} #{food}"
# # remove the used object from the array
# adjectives.delete(adjective)
# methods.delete(method)
# foods.delete(food)
# end


# version 2

10.times do |item|
# # pick random element from array and remove it
adjective = adjectives.delete_at(rand(adjectives.length))
method = methods.delete_at(rand(methods.length))
food = foods.delete_at(rand(foods.length))

puts "#{item + 1}. #{adjective} #{method} #{food}"

end