I have an array
val doot = Array("a", "b", "c")
I want to replace the 2nd index with the letter "z", but I do not want to modify doot. I want to create a new array, as that seems to be the idiom in scala.
So far, I can only modify the array with update
doot.update(1, "z") // But now doot is modified directly, not ideal!
Does scala offer a way to do this?
immutable arraysince it's immutable. i.e. cannot change.Array, and it is mutable.