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 how to create the correct number of arguments, so when the method is called back it gives me my array_sum.
I have been trying many different variations, but it has now come down to I am not sure if my defining is wrong or my code in the method is incorrect.
I want to say it is something such as
def please_work() array1=[1,2,3] array2=[4,5,6] array_sum=array1+array2 end puts please_work(array_sum)
i ended up fiddling around and getting it to output [1,2,3,4,5,6], but my syntex said i did not have the correct number of arguments. Also, sometimes i get array_sum is not a defined variable. If I am defining it in the method, shouldn't it be defined if i call the method again?
thanks taking a look at my question alex