Assume I have a function that return multiple values in scala.
def foo:(Double, Double) = {
(1.1, 2.2)
}
I can call it as below without a problem.
val bar = foo
or
val (x, y) = foo
However, if I try to update existing variables like below, it doesn't work.
var x = 1.0
var y = 2.0
(x, y) = foo
This returns an error saying error: ';' expected but '=' found
Is there any reason behind this. Why can't I update the existing variables using (x, y) = foo