Created
September 20, 2018 14:32
-
-
Save kopylovvlad/a03dd40bc666425c9e5ccd4db76eae9a 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 foo(number, index = 1) | |
# limit | |
raise ArgumentError, 'number must be <= 10 000' if number > 10_000 | |
# exit | |
return number.to_s if number == index | |
# step | |
index.to_s + ' ' + foo(number, index + 1) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment