I understand that I can write
myArray(index) = newValue
to update an array. However, I don't understand how this works internally. I learned from another question here that = is usually not a method call in Scala. I also understand that the brackets are shorthand for calling the apply() method on an object, so I assume myArray(index) means myArray.apply(index).
But how does it work to assign a value to something that has just been returned from a method call?