Hi ruby-foum!
I’m trying to find the sum of all of the integers within a given range, up to and including the base and highest integer:
def get_sum(a,b)
@a = a
@b = b
if @a == @b
return @a
else
return (@a…@b).to_a.sum
end
end
this works fine on positive integers. however,
get_sum(0,-1)
returns 0. I would expect -1?