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

sorry if that wasn't so clear. again,

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

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

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

kind regards -botp