Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.10 KB | None | 0 0
  1. class Array
  2.   def product
  3.     inject(1) { |n, value| n * value }
  4.   end
  5. end
  6.  
  7. puts [1,2,3,4,5].product
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement