Project

General

Profile

Actions

Bug #9139

closed

each_with_index

Bug #9139: each_with_index

Added by dostapn (Dima Ostapenko) over 12 years ago. Updated over 12 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]
[ruby-core:58493]

Description

Whats wrong with index?

Array.new(4, Hash.new).each_with_index{ |item, index| item["index"] = index; item["value"] = 10*index; p index;}
0
1
2
3
=> [{"index"=>3, "value"=>30},
{"index"=>3, "value"=>30},
{"index"=>3, "value"=>30},
{"index"=>3, "value"=>30}]

Actions

Also available in: PDF Atom