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