-
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 - <Salome Wubeshet> - <Calculator> #32
base: master
Are you sure you want to change the base?
Conversation
|
||
def add(num1, num2) | ||
return num1 + num2 | ||
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.
You're using tabs for indentation - please use two spaces per level of indentation instead. It doesn't make a big difference one way or the other, but keeping our style consistent across the class will make it much easier when we start doing group projects.
You can set your editor up to do this automatically, let me know if you need help with this.
|
||
def division(num1, num2) | ||
return num1 / num2 | ||
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.
I like that you've split these out into separate methods! It may seem a little pedantic for things like + and -, but for more complicated methods (imagine finding the least common multiple of two numbers, or even checking for zero before doing division) it results in much cleaner code.
result = add(num1, num2) | ||
puts "#{result}" | ||
elsif(operation =='subtract' || operation == '-'|| operation == 'minus' ) | ||
result = subtract(num1, num2) |
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.
You've got many lines here that all say puts #{result}
. Would it be possible to DRY this code up somehow?
CalculatorWhat We're Looking For
Great work overall! |
Calculator
Congratulations! You're submitting your assignment.
Comprehension Questions