title: Case Match Scala
body: <p>We have this as an exam question (practice) and the answer is 1 and 6. I have no idea how this is the answer and stepping the program also didn't help. Could anyone explain why this is the answer and how to approach this question.</p>
  
  <pre><code>    var value1: Int = 4
      var value2: Int = 6
  
      value1 match {
  
        case 1 =&gt; value2 += 1
  
      case 2 =&gt; value2 -= 4
  
      case 3 =&gt; value1 = value2 * 2
  
      case 4 =&gt; value1 -= 3;
  
      case 5 =&gt; value2 += 1
  
      case _ =&gt; value1 = value2 + 1
  
      }
  
  println("value1 = " + value1 + ", value2 = " + value2)
  </code></pre>