Skip to content

Conversation

@saria-b
Copy link
Contributor

@saria-b saria-b commented Mar 24, 2017

No description provided.


def string
x = @fizzbuzz
if x % 3 == 0 && x % 5 == 0

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

def string
x = @fizzbuzz
if x % 3 == 0 && x % 5 == 0
return "fizzbuzz"

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
Copy link
Member

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

Copy link
Member

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants