I'm doing it:
a = [1,2,3,4] b = [2,3,4,5] c = b - a put c
I get this answer → [1]
I want to get this answer → [1,1,1,1]
(for example, matrix addition / subtraction)
I tried this:
c.each {|e| c[e] = b[e] - a[e]}
but I get this answer: [1,0,0,0]
Can someone give me the correct way to do this? Many thanks!
source share