temp=arr.delete_at(arr.length-1) b=all_sum(arr)+all_sum(arr).collect{|i| i+temp}
end
c=[1,2]
p all_sum©Error: in `all_sum’: stack level too deep (SystemStackError)
Can anyone give me some advice?
Hmm,
the b= lines doesn’t make much sense, you may want to replace
them with return statemants.
Note that delete_at modifies the receiver - the original array
(for this and all other recursions). So it won’t work even if
you change the b= to return.
cheers
Simon