Skip to content

Instantly share code, notes, and snippets.

@kopylovvlad
Created September 20, 2018 14:32
Show Gist options
  • Save kopylovvlad/a03dd40bc666425c9e5ccd4db76eae9a to your computer and use it in GitHub Desktop.
Save kopylovvlad/a03dd40bc666425c9e5ccd4db76eae9a to your computer and use it in GitHub Desktop.
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