See the following code:
val names = Set("Mike", "Jack")
names += "Jeff"
There will be an error:
error: reassignment to val
I see in some books, it said += is actually a method, and the code can be:
val names = Set("Mike", "Jack")
names.+=("Jeff")
If += is a method, why will it assign the "names"?