class Array
def inject(n,&f)
each{|i| n=f.call(n,i)}
n
end
end

puts (1..5).to_a.inject(1){|n,i| n*i}
puts (1..5).to_a.inject(0){|n,i| n+i}