Skip to content

Instantly share code, notes, and snippets.

@jonathanpike
Created October 15, 2015 19:32
Show Gist options
  • Save jonathanpike/361a3bac07c499f5bcc3 to your computer and use it in GitHub Desktop.
Save jonathanpike/361a3bac07c499f5bcc3 to your computer and use it in GitHub Desktop.
def reverse(string)
arr = string.split("")
n = arr.length
index = -1
new = []
until index == (-n - 1)
new << arr[index]
index -= 1
end
puts new.join("")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment