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