Skip to content

Instantly share code, notes, and snippets.

@Catsquotl
Created November 12, 2013 10:26
Show Gist options
  • Save Catsquotl/7428705 to your computer and use it in GitHub Desktop.
Save Catsquotl/7428705 to your computer and use it in GitHub Desktop.
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