3 ms·
The reason it's right is that if it was done by aliasing, it would create a wierd trap variable, an invisible pointer dereference which would modify something e
by JulianMorrison 13y ago
The reason it's right is that if it was done by aliasing, it would create a wierd trap variable, an invisible pointer dereference which would modify something else.
a := 1
b := []int{2,3,4}
for i, c := range b {
// lots more code
a = 5
c = 6
// now a is 5 and c is 6 as you'd expect
// but also by magic, b[i] is 6
}
// now by magic, b is {6,6,6}