#Why does this program panic on run time?
6 messages · Page 1 of 1 (latest)
from the spec:
The assignment proceeds in two phases. First, the operands of index expressions and pointer indirections (including implicit pointer indirections in selectors) on the left and the expressions on the right are all evaluated in the usual order. Second, the assignments are carried out in left-to-right order.
i.e. a and a[0] are both evaluated before either of the assignments happen
Is this also why a, b = b, a works?
yes exactly
Actually you could argue not