Created
December 1, 2015 16:44
-
-
Save amaxwellblair/8f0e2c5c2a945e8320f8 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 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