Sum & Product of an Array Ruby script

SPONSORED LINKS

    Specification

  • Version:
  • File size: 0 KB
  • File name: ruby
  • Last update:
  • Platform: Windows / Linux / Mac OS
  • Language: Ruby
  • Price:Other Free / Open So
  • Company: Arto Bendiken (View more)

Sum & Product of an Array script description:




Publisher review:
Sum & Product of an Array - How to sum all the numbers in an array, or get the multiplication product of the same numbers, without resorting to an ugly for loop? How to sum all the numbers in an array, or get the multiplication product of the same numbers, without resorting to an ugly for loop?

Ruby’s inject to the rescue; this snippet extends the array class with the methods sum and product, which can hereafter be used on any array in Ruby. Note that the parameter to inject is the initial value of s, the result, and thus obviously different depending on whether we’re doing addition or multiplication.
Sum & Product of an Array is a Ruby script for Communication Tools scripts design by Arto Bendiken. It runs on following operating system: Windows / Linux / Mac OS.
Sum & Product of an Array - How to sum all the numbers in an array, or get the multiplication product of the same numbers, without resorting to an ugly for loop?

Operating system:
Windows / Linux / Mac OS

Latest script and internet news

222

222

22

Posted on: 18 Jul 2023 22:27 by A. Brown

111

111

111

Posted on: 18 Jul 2023 22:24 by A. Brown

The permanently active Push system offered by the new Google Chrome 42

The permanently active Push system offered by the new Google Chrome 42

Hacked By !Sc-sT

Posted on: 17 Mar 2015 07:57 by A. Brown

SPREAD THE WORD

User Rating


Rating: 2.2 out of 5
Based on 13 ratings. 13 user reviews.

  • Currently 2.15 out of 5
  • 1
  • 2
  • 3
  • 4
  • 5