-
Notifications
You must be signed in to change notification settings - Fork 0
Sarahb fizzbuzz #6
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
base: master
Are you sure you want to change the base?
Conversation
models/sarahb_fizzbuzz.rb
Outdated
|
|
||
| def string | ||
| x = @fizzbuzz | ||
| if x % 3 == 0 && x % 5 == 0 |
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.
change to a case statement rather than if/elsif.
Perhaps move the % == 0 tests outside the case statement - set as a variable and then check if the variable is true/false inside the case statement. Means you'll only be performing each % check once rather than potentially twice
models/sarahb_fizzbuzz.rb
Outdated
| def string | ||
| x = @fizzbuzz | ||
| if x % 3 == 0 && x % 5 == 0 | ||
| return "fizzbuzz" |
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.
Great code! Do you need to have 'return' written here?
|
|
||
| end | ||
|
|
||
| puts Fizzbuzz.new(15).string |
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.
rogue puts
| fb = Fizzbuzz.new(15) | ||
| expect(fb.string).to eq('fizzbuzz') | ||
| 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.
watch spare lines between 'end'
| @@ -1 +1 @@ | |||
| 2.4 | |||
| 2.4.0 | |||
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.
try not to change these files in a feature change
No description provided.