Last active
August 29, 2015 14:02
-
-
Save bomatson/f1a700f4453731ce3f9e to your computer and use it in GitHub Desktop.
This file contains hidden or 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_for_fizz(n) | |
if (n % 15).zero? | |
"FizzBuzz" | |
elsif (n % 5).zero? | |
"Buzz" | |
elsif (n % 3).zero? | |
"Fizz" | |
else | |
n | |
end | |
end | |
# then use the function in your loop: | |
1.upto(100) do |n| | |
puts check_for_fizz(n) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment