Created
October 20, 2019 10:12
-
-
Save yalab/704596cab675cb93234963456b77172c 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 fizz_buz(n) | |
return if n > 100 | |
word = if n % 15 == 0 | |
'fizz buz' | |
elsif n % 3 == 0 | |
'fizz' | |
elsif n % 5 == 0 | |
'buz' | |
end | |
puts word if word | |
fizz_buz(n + 1) | |
end | |
fizz_buz(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment