Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
FizzBuzz Refactor Exercise
def fizzBuzz(_start,_end)
_start.upto(_end) {|i|
puts "Fizz" if i%3 == 0 && i%5 != 0
puts "Buzz" if i%3 != 0 && i%5 == 0
puts "FizzBuzz" if i%3 == 0 && i%5 == 0
puts i if i%3 != 0 && i%5 != 0
}
end
fizzBuzz(3,30)
fizzBuzz(30,45)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment