-
Notifications
You must be signed in to change notification settings - Fork 42
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
Pipes - <Lindsey> - <Calculator> #27
base: master
Are you sure you want to change the base?
Conversation
Pipes - <Lindsey Deuel> - <Calculator>
return do_math("/", numbers[0], numbers[1]) | ||
elsif operation == "modulo" || operation == "%" | ||
return do_math("%", numbers[0], numbers[1]) | ||
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.
If the user inputs a bogus operator, your program quits silently. Instead, it would be polite to let them know what went wrong.
def do_math(operation,num1, num2) | ||
if operation == "+" | ||
puts "#{num1} + #{num2} = #{num1+num2}" | ||
elsif operation == "-" |
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.
This big if
statement looks very similar to the one in process_operator
- would it be possible to consolidate the two?
|
||
def get_number(operation) | ||
begin | ||
puts "What's your first number?" |
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.
I like making getting a number from the user its own method - good organization.
CalculatorWhat We're Looking For
Great work overall! |
Pipes - -
Calculator
Congratulations! You're submitting your assignment.
Comprehension Questions