Frederick Cheung wrote in post #1120015:
> On Thursday, August 29, 2013 11:02:10 PM UTC+1, Ruby-Forum.com User
> wrote:
>>
> Dheeraj's code has optional arguments. In such circumstances arity will
> return a negative number (where -1 means that the method requires at
> least
> 0 arguments, -1 would
Dheeraj Kumar wrote in post #1120004:
> Could you paste your test?
>
> --
> Dheeraj Kumar
The code for the number of arguments and the part which is failing is
it "requires two arguments" do
method(:array_sum).arity.should eq 2
end
Thanks Dheeraj. Quick question about the pick axe boo
Dheeraj Kumar wrote in post #1119995:
> def array_sum(array1 = [], array2 = [])
> array1 + array2
> end
>
> array_sum([1,2,3], [4,5,6])
> => [1, 2, 3, 4, 5, 6]
>
>
> --
> Dheeraj Kumar
Is there a reason why when i would run a test it would say -1 arguments
instead of 2? You had listed two (arra
Dheeraj Kumar wrote in post #1119998:
> 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
Hi Colin and Dheeraj,
First off thanks for your help. It is actually quite funny, I ordered
that exact book a few
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
Walter Davis wrote in post #1119974:
> On Aug 29, 2013, at 1:03 PM, Alex Froelich wrote:
>
>>>>
>>> 1.9.3p429 :003 >
>>>
>> puts "Yes, Movies are awesome!"
>>
>> thanks,
>> Alex
>
> Your method is called welcome(), but
Walter Davis wrote in post #1119949:
> On Aug 29, 2013, at 10:42 AM, Alex Froelich wrote:
>
>> Hi Ruby on Rails community!
>>
>> I am trying to write a program that uses the .match command to find out
>> if a string contains a certain word-then using that info
Hi Ruby on Rails community!
I am trying to write a program that uses the .match command to find out
if a string contains a certain word-then using that information write a
conditional statement. The issue I am running into is that I am self
teaching myself and do not really know how to properly us
8 matches
Mail list logo