Skip to content

Instantly share code, notes, and snippets.

@amaxwellblair
Created December 1, 2015 16:44
Show Gist options
  • Save amaxwellblair/8f0e2c5c2a945e8320f8 to your computer and use it in GitHub Desktop.
Save amaxwellblair/8f0e2c5c2a945e8320f8 to your computer and use it in GitHub Desktop.
def supafizbuz(max_num)
range = (0..max_num).to_a
range.each do |num|
a = num % 7 == 0 ? "Super" : ""
b = num % 3 == 0 ? "Fizz" : ""
c = num % 5 == 0 ? "Buzz" : ""
puts (a + b + c) == "" ? num : (a + b + c)
end
return nil
end
supafizbuz(1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment