Increase value of element in array. Like setindex!, but addition

I take it that you don’t want to make your own addindex! function for some reason?

function addindex!(a, idx, v)
      b = copy(a)
      b[idx] += v
      return b
end
3 Likes