Skip to content

Instantly share code, notes, and snippets.

@robinsloan
Created October 24, 2012 01:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robinsloan/3943251 to your computer and use it in GitHub Desktop.
Save robinsloan/3943251 to your computer and use it in GitHub Desktop.
Ruby zip
# zip two collections together then iterate in lockstep
first_names = "Clark", "Bruce", "Diana"
last_names = "Kent", "Wayne", "Troy"
first_names.zip(last_names) do |first, last|
puts "#{first} #{last}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment