Skip to content

Instantly share code, notes, and snippets.

@fabianuribe
Last active December 19, 2015 05:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabianuribe/5901672 to your computer and use it in GitHub Desktop.
Save fabianuribe/5901672 to your computer and use it in GitHub Desktop.
Reverse a string using recursion
def recursive_reverse string
return '' if string.empty?
string.slice!(-1) + recursive_reverse(string)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment