Created
March 3, 2015 22:13
-
-
Save Andsbf/464e9486260374f34899 to your computer and use it in GitHub Desktop.
FizzBuzz Refactor Exercise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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