Created
November 12, 2013 10:26
-
-
Save Catsquotl/7428705 to your computer and use it in GitHub Desktop.
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 check num | |
fizz_buzzez= [] | |
if num % 3 == 0 | |
fizz_buzzez << 'Fizz' | |
end | |
if num % 5 == 0 | |
fizz_buzzez << 'Buzz' | |
end | |
fizz_buzzez | |
end | |
1.upto 16 do |num| | |
ar = check num | |
if ar.empty? | |
str = num | |
else | |
str = ar.compact.join | |
end | |
puts str | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment