Last active
January 12, 2024 18:30
-
-
Save jancel/884196 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 fizzbuzz( number, index = 1 ) | |
# Do this in one pass | |
value = "" | |
value += "fizz" if (index % 3 == 0) | |
value += "buzz" if (index % 5 == 0) | |
p value | |
# and next number | |
fizzbuzz( number, index + 1 ) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment