Created
April 25, 2014 16:48
-
-
Save quotha/11295942 to your computer and use it in GitHub Desktop.
Reverse a string
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 reverse_string front, back="" | |
if front.size > 1 | |
reverse_string front[0..front.size-2], (back + front[front.size-1]) | |
else | |
back + front | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment