title: Val cannot be reassigned a compile time error for a local variable in fun in Kotlin
body: <p>Here in fun swap I am trying to change the value of a1 with b1, but it shows <em>"val cannot be reassigned compile time error"</em>. If I can't change like this, then how is it possible to do?</p>
  
  <pre><code>fun swap(a1: String, b1: String) {
     val temp = a1
     a1 = b1
     b1 = temp
  }
  </code></pre>
  
  <p>Note: This is just a sample to know why I am not able to reassign the local variable as we can do in Java.</p>