I am learner of go language. This is very basic question. Please check the below sample code, and look into 3rd line.
a := [3]int{10,20}
var i int = 50
i, a[2] = 100, i
fmt.Println(i) //100
fmt.Println(a) //[10 20 50]
I have overwriten the value 100
in i
variable and immediately applied the int array. When I printed the array, the new value was not printed. How does multiple variable assignment work in go? Why the i
value is not updated into the array immediately?