From: Lars Haugseth Date: 2012-09-22T20:40:49+09:00 Subject: Re: the behavior of iterator methods On 09/21/2012 04:32 PM, Cliff Rosson wrote: > So you can accomplish what you want like so. > > a = [1, 2, 3] > a.each_with_index { |x, index| a[index] += 1 } > puts a > > Or > > (0...a.length).each { |x| a[x] += 1 } Simpler: a.map! {|x| x + 1} Simplest: a.map! &:succ -- Lars Haugseth