Created
September 26, 2013 03:53
-
-
Save mecampbellsoup/6709696 to your computer and use it in GitHub Desktop.
Ruby FizzBuzz!
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 fizz_buzz num | |
puts "FizzBuzz" if num % 15 == 0 | |
puts "Fizz" if num % 3 == 0 | |
puts "Buzz" if num % 5 == 0 | |
puts num | |
end | |
(1..50).each do |n| | |
fizz_buzz n | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment