Last active
December 3, 2015 21:32
-
-
Save xander-miller/ea885f8bf5978a8d8ff6 to your computer and use it in GitHub Desktop.
Rewriting the string reverse method.
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 reversi str = "" | |
out = '' | |
1.upto str.length do |i| | |
out << str.chars[-i] | |
end | |
out | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment