I was recently reading this book about the Ruby programming language, and came across this piece of example code:
[1,3,5,7].inject(0) {|sum, element| sum+element} -> 16
[1,3,5,7].inject(1) {|product, element| product*element} -> 105
Inject is a method which acts on an array...