title: Scala assigning multiple returned values from a function
body: <p>Given this Scala function</p>
  
  <pre><code>def mv: (Int,Int,Int) = {
    (1,2,3)
  }
  </code></pre>
  
  <p>The following works</p>
  
  <pre><code>val (i,j,k) = mv
  </code></pre>
  
  <p>But this does not</p>
  
  <pre><code>var i = 0
  var j = 0
  var k = 0
  (i,j,k) = mv
  &lt;console&gt;:1: error: ';' expected but '=' found.
     (i,j,k) = mv
             ^
  </code></pre>
  
  <p>This implies that assigning to multiple variables only works when they are initialized? or maybe I'm writing it incorrectly? Trying to find a way to return several values from a function and assign the values to instance variables in a Class, which means the variables can't be initialized when the function is called because they are declared outside of all methods.</p>
  
  <pre><code>class C {
    var i = 0
    var j = 0
    var k = 0
    def mv: (Int,Int,Int) = {
      (1,2,3)
    }
    def changeState: Unit = {
      (i,j,k) = mv
    }
  }
  </code></pre>
  
  <p>The above does not work. I could create a case class to hold the return values but would like to make something this work since it seems more clear.   </p>