-
Notifications
You must be signed in to change notification settings - Fork 48
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
Anibel - Calculator - Edges #30
base: master
Are you sure you want to change the base?
Conversation
CalculatorWhat We're Looking For
Hi Anibel! Your calculator project looks great. I think that your methods are really clever-- not only did you separate/organize your code into sections by creating methods, but you thought of the code deeply enough to see opportunities to separate them by responsibility. I want to particularly highlight something really cool you did: You made your If I were to make a major recommendation for your code, it would be: your calculation methods return an array Maybe I'm adding a few other comments for minor improvements, but they are simply small suggestions. In general, I think that the code is extremely clean and clever. Great job! |
when "modulo", "%" | ||
valid_prompt = true | ||
print_result(modulo, "%") | ||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case
statements, the "catch all" for "nothing matched" is usually default
, not else
|
||
# calls the function for printing results depending on operator | ||
# the arguments of print_result are evaluated so that an array and a string are passed | ||
case operator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for every when
in this case statement, there's the repeated line valid_prompt = true
.
Instead of repeating yourself, maybe you can invert this-- before the case statement, say valid_prompt = true
. Then, if it hits the default
(because nothing matched), you can say valid_prompt = false
["first", "second"].each do |order| | ||
puts "Enter the #{order} number:" | ||
num << is_a_num(gets.chomp) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clever!
Calculator
Congratulations! You're submitting your assignment.
Comprehension Questions