Skip to content

Conversation

isabeldepapel
Copy link

Random Menu

Congratulations! You're submitting your assignment.

Comprehension Questions

Question Answer
How did you store menu components? Why? As an array b/c the instructions specified creating 3 arrays. And then on the optional part, I switched to using a hash b/c it seemed a little more logical
Could you have stored components using a different data structure? For example, if you used an Array could you have used a Hash? Yes, so I switched data structures on the optional part
Did you find yourself repeating the same code? Why did you have to do it that way? Yes (and I hate it), so I put the parts I could into methods (like prompting the user to enter food items). But I couldn't figure out a way to not have the menu hash twice--once in the main program, and once in the a method I defined. A global variable might work, but I don't know how to define those in Ruby
What type of loop did you use? Why did you choose that type? I used until to validate user input, and while to keep prompting the user for input because those will keep going until the conditions are met. And then I used a range to generate the random menu because I only wanted to do one loop a certain number of times so I couldn't iterate through the array itself. I guess I could have done a times loop, but a range was the first thing I thought of so I went with that.

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.

1 participant