Created
July 19, 2016 19:20
-
-
Save jkirkpatrick24/c99ba15e4df892800018f1040f54c6b3 to your computer and use it in GitHub Desktop.
FizzBuzz Refactor
This file contains hidden or 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(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