Skip to content

Instantly share code, notes, and snippets.

@jkirkpatrick24
Created July 19, 2016 19:20
Show Gist options
  • Save jkirkpatrick24/c99ba15e4df892800018f1040f54c6b3 to your computer and use it in GitHub Desktop.
Save jkirkpatrick24/c99ba15e4df892800018f1040f54c6b3 to your computer and use it in GitHub Desktop.
FizzBuzz Refactor
def fizzbuzz(x,y)
number = x..y
number.each do |i|
if i % 15 == 0
puts "FizzBuzz"
elsif i % 3 == 0
puts "Fizz"
elsif i %5 == 0
puts "Buzz"
else puts i
end
end
end
fizzbuzz(1,15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment