Skip to content

Instantly share code, notes, and snippets.

@jnstq
Created March 24, 2009 20:22
Show Gist options
  • Save jnstq/84349 to your computer and use it in GitHub Desktop.
Save jnstq/84349 to your computer and use it in GitHub Desktop.
require "enumerator"
[10,20,30].enum_for(:each_with_index).map { |value, index| puts "Value: #{value} Index: #{index}" }
[1,2,3].each_cons(2) do |l, r|
puts "left: #{l}"
puts "right: #{r}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment