On Sun, Jan 23, 2011 at 11:00 PM, botp <botpena / gmail.com> wrote:
> =A0(0..5).each.with_index.inject(0){|sum,(i,j)| =A0sum+j}
> =A0#=3D> 15
> =A0(0..5).each.with_index.inject(0){|sum,(i,j)| =A0sum+i*j}
> =A0#=3D> 55

sorry if that wasn't so clear. again,

  (3..5).each.with_index.inject(0){|sum,(value,index)|  sum+value}
  #=3D> 12

  (3..5).each.with_index.inject(0){|sum,(value,index)|  sum+index}
  #=3D> 3

  (3..5).each.with_index.inject(0){|sum,(value,index)|  sum+index*value}
  #=3D> 14

kind regards -botp