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 - Sahana Murthy - Random Menu #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sahanamurthy
Copy link

Random Menu

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
Would a hash work just as well as an Array in this project? Why? No, because a hash would require keys associated with the values (the values being descriptive words). I do not know what the keys would be in this case. An array allows for just the values to be listed.
Did you find yourself repeating the same code? Why did you have to do it that way? Yes, as there were three different arrays for descriptive words, I found myself repeating code specific to each different array. If I hadn't, I wouldn't have been able to specify commands to the arrays.
What type of loop did you use? Why did you choose that type? I used a times loop because I knew I wanted the loop to iterate only a certain number of times (determined by the user input for the number of menu items.

Copy link

@droberts-sea droberts-sea left a comment

Choose a reason for hiding this comment

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

Random Menu

What We're Looking For

Feature Feedback                                                                              
Baseline
Random Menu of 10 items displayed in the terminal. Yes
Generator pulls one random item from each array to create menu items. Yes
Readable code with consistent indentation. Yes
Extras
Menu components are not repeated Yes
User can specify how many menu items to see Yes

Excellent work overall!

# Generate random Menu
# Delete items from arrays so they cannot be used again
if user_input <= 10
user_input.times { |n|

Choose a reason for hiding this comment

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

In this class, we'll encourage you to use do...end instead of curly braces. They function the same, but I think do...end is more legible.

# Delete items from arrays so they cannot be used again
if user_input <= 10
user_input.times { |n|
puts "#{ n + 1 }. #{adjective = array_adjective.sample} #{style = array_style.sample} #{food = array_food.sample}"

Choose a reason for hiding this comment

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

I like the idea of storing the chosen menu components in variables and then removing them from the lists. However, assigning a variable inside of a string interpolation is a little hard to read. Could clean this up by breaking it into multiple lines?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants