Colin is right. You should try reading a book, like this one:
http://pragprog.com/book/ruby4/programming-ruby-1-9-2-0
--
Dheeraj Kumar
On Friday 30 August 2013 at 2:12 AM, Colin Law wrote:
> On 29 August 2013 21:40, Dheeraj Kumar (mailto:a.dheeraj.ku...@gmail.com)> wrote:
> > def array_sum(a
On 29 August 2013 21:40, Dheeraj Kumar wrote:
> def array_sum(array1 = [], array2 = [])
> array1 + array2
> end
>
> array_sum([1,2,3], [4,5,6])
> => [1, 2, 3, 4, 5, 6]
Also I suggest the OP works through a good Ruby primer.
Colin
>
> --
> Dheeraj Kumar
>
> On Friday 30 August 2013 at 2:01 AM,
def array_sum(array1 = [], array2 = [])
array1 + array2
end
array_sum([1,2,3], [4,5,6])
=> [1, 2, 3, 4, 5, 6]
--
Dheeraj Kumar
On Friday 30 August 2013 at 2:01 AM, Alex Froelich wrote:
> Hello again ruby community!
>
> I just learned how to add two arrays(I know, i know).
>
> My program
Hello again ruby community!
I just learned how to add two arrays(I know, i know).
My program looked like this
array1=[1,2,3]
array2=[4,5,6]
array_sum=array1+array2
I thought pretty simple stuff, they are combined. However, now i am
looking to define that code as a method and I do not understand
4 matches
Mail list logo