Skip to content

Conversation

anderschenders
Copy link

Random Menu

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
How did you store menu components? Why? In three arrays
Could you have stored components using a different data structure? For example, if you used an Array could you have used a Hash? Yes, I think I could have stored them in a hash, and used numbers as the keys, but that may have been overly complicated
Did you find yourself repeating the same code? Why did you have to do it that way? Yes, I did initially, when asking the user for input to populate the three arrays. To address this, I created a function that could add user input to an array, and called this function three times.
What type of loop did you use? Why did you choose that type? I used an until loop to generate the menu output so that it could be flexible to account for different user choices of the number of items they wanted displayed; after receiving the number the user entered as their preferred number of items to list, I ran the loop until the count (which started at 0) reached that number.

@droberts-sea
Copy link
Collaborator

Random Menu

What We're Looking For

Feature Feedback
Random Menu of 10 items displayed in the terminal. yes
Generator pulls one random item from each array to create menu items. yes
Baseline
Readable code with consistent indentation. yes

Great work overall! Good job on the optionals.

@@ -0,0 +1,67 @@
# function for creating lists of user input
def array_generator(displayed_items, descriptor)
Copy link
Collaborator

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 using a function here - really helps to DRY up your code.

if menu_items[num].include?("pie")
puts "Yay pie!"
else
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very nice. Note that you don't need to include the else keyword if there's nothing to do, you could just say

if whatever
  # do things
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants