P
Peña, Botp
Hi All,
How does one access the array index in #map?
eg,
irb(main):002:0> [1,2,3,4,5,6].map! {|x| x*2 }
=> [2, 4, 6, 8, 10, 12]
i'd like to double the element values except those loc on the 2nd and 5th
indices eg.
sorry if the answer is too obvious but i cannot find something like
array#each_with_index...
thanks in advance
kind regards -botp
How does one access the array index in #map?
eg,
irb(main):002:0> [1,2,3,4,5,6].map! {|x| x*2 }
=> [2, 4, 6, 8, 10, 12]
i'd like to double the element values except those loc on the 2nd and 5th
indices eg.
sorry if the answer is too obvious but i cannot find something like
array#each_with_index...
thanks in advance
kind regards -botp