Skip to content

Instantly share code, notes, and snippets.

@jstotz
Created February 13, 2012 20:53
Show Gist options
  • Save jstotz/1820315 to your computer and use it in GitHub Desktop.
Save jstotz/1820315 to your computer and use it in GitHub Desktop.
Ruby Enumerable#zip
enum1 = [:a, :b, :c]
enum2 = [1, 2, 3]
enum1.zip(enum2) do |x, y|
puts "#{x} -> #{y}"
end
# Output:
# a -> 1
# b -> 2
# c -> 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment