Re: how to sum element of array

2012-09-04 Thread Иван Бишевац
2012/9/4 Edward QU > dear all > > 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? > > many thanks! > best regards > Edward > > -- > Posted via http://www.ruby-forum.com/. > > One suggestion. I'm beginner in Ruby too, and I find http://ruby-d

Re: how to sum element of array

2012-09-04 Thread Robert Klemme
On Tue, Sep 4, 2012 at 10:37 AM, Henry Maddocks wrote: > > On 4/09/2012, at 8:33 PM, Robert Klemme wrote: > >> On Tue, Sep 4, 2012 at 10:19 AM, Edward QU wrote: >>> dear all >>> >>> 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? >> >>

Re: how to sum element of array

2012-09-04 Thread Robert Klemme
On Tue, Sep 4, 2012 at 10:19 AM, Edward QU wrote: > dear all > > 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? Open the text editor, start typing... Seriously: how would you do it on paper if you would not know beforehand how many items t