Last active
October 24, 2018 05:25
-
-
Save chrisseaton/c09250349aa3f77c4d0f5ad81b2aa450 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 fizzbuzz(n) | |
if n % 3 == 0 && n % 5 == 0 | |
'FizzBuzz' | |
elsif n % 3 == 0 | |
'Fizz' | |
elsif n % 5 == 0 | |
'Buzz' | |
else | |
n | |
end | |
end | |
(1..20).each do |n| | |
puts fizzbuzz(n) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment