Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Array
- def product
- inject(1) { |n, value| n * value }
- end
- end
- puts [1,2,3,4,5].product
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement