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

Queues - Marisol Lopez - Random Menu #34

Open
wants to merge 2 commits 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
16 changes: 16 additions & 0 deletions random_menu.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#3 arrays with different food adjectives, cooking style, and types

food_adjectives = ["hot", "soft", "small", "soggy", "watery", "crispy", "burnt", "slimey", "creamy", "greasy"]
cooking_styles = ["steamed", "grilled", "baked", "roasted", "boiled", "fried", "barbequed", "microwaved", "stir-fried", "poached"]
different_foods = ["chicken", "steak", "salmon", "dumplings", "pizza", "tacos", "sandwiches", "pasta", "cake", "tofu"]

#index so that it'll print a new number within loop
index = 1

puts "\nHere is your specialized menu.\n\n"
#running through the number of elements in food_adjectives array
10.times do
#used string interpolation to print menu
puts "#{index}. #{food_adjectives.delete_at(rand(food_adjectives.length))} #{cooking_styles.delete_at(rand(cooking_styles.length))} #{different_foods.delete_at(rand(different_foods.length))}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

array.delete_at(rand(array.length)) is a clever way to solve this problem. However, this line ended up being long and difficult to read. How might you split the code up to increase readability?

index += 1
end