Am 04.09.2012 10:19, schrieb Edward QU:
> a_array=[2,4,6,8,10]
> I want to sum the elements of the array:
> 2+4+6+8+10
> how to write the script?


If I have no idea how to start, I usually ask Google first...
try "sum elements array ruby".

You will often find your questions already answered on Stack Overflow:

http://stackoverflow.com/questions/1538789/how-to-sum-array-members-in-ruby

(In my case, it was the second link from the search results.)


-- 
<https://github.com/stomar/>