Skip to content

Instantly share code, notes, and snippets.

@theverything
Created June 9, 2013 01:50
Show Gist options
  • Save theverything/5737286 to your computer and use it in GitHub Desktop.
Save theverything/5737286 to your computer and use it in GitHub Desktop.
reverse an array
array = []
100.times { |i| array << i }
def my_reverse(array = [])
size = array.size
b = array.dup
b.reverse_each do |i|
b << i
end
b.drop(size)
end
my_reverse array
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment