Branches - Kristy #27
Conversation
CalculatorWhat We're Looking For
Well done on this project, Kristy! Your code is logical, well-organized, and readable. You did a GREAT job on the methods that you pulled out! You accidentally have two bugs 😂 When doing the calculation, you do addition sometimes when you shouldn't. There are some comments, along with a few other minor suggestions on how to improve the code too. Overall, great work on this project! |
| else | ||
| puts "You can't really divide numbers by 0... Awkward.." | ||
| end | ||
| end |
There was a problem hiding this comment.
Nicely done pulling this into a method!
| end | ||
| end | ||
|
|
||
| def check_num |
There was a problem hiding this comment.
This is a minor suggestion, but: Instead of the name check_num, there may be a better name for this. What is this method responsible for? Since it's responsible for getting user input until it's valid, I may call it get_valid_user_input, but there are definitely a lot of other options that are good too.
| puts "#{num1} #{operator} #{num2}: #{value}" | ||
| when "subtract", "-" | ||
| operator = "-" | ||
| value = num1 + num2 |
There was a problem hiding this comment.
Oh no! This is subtract, but you accidentally copy/pasted and left it as + 😂
| puts "#{num1} #{operator} #{num2}: #{value}" | ||
| when "multiply", "*" | ||
| operator = "/" | ||
| value = num1 + num2 |
There was a problem hiding this comment.
Same as above-- seems like you have some copy/paste errors. operator should be *, and value = num1 * num2
Calculator
Congratulations! You're submitting your assignment.
Comprehension Questions