Skip to content

Instantly share code, notes, and snippets.

@mickey
Created November 7, 2009 22:58
Show Gist options
  • Save mickey/228928 to your computer and use it in GitHub Desktop.
Save mickey/228928 to your computer and use it in GitHub Desktop.
def dup(toto)
a = []
toto.each do |b|
a << b
end
a
end
dup([1,2,3])
=======
def dup(toto)
a = toto.inject([]) do |sum, b|
sum << b
end
end
dup([1,2,3])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment