4 ms·
Completely OT but, after 5 years of writing Go, TIL you can assign multiple LHS from multiple RHS: c1, c2 := a[i], b[i]
by kitd 4y ago
Completely OT but, after 5 years of writing Go, TIL you can assign multiple LHS from multiple RHS:
c1, c2 := a[i], b[i]
- rob74 4y agoWell, duh... I mean, that's the same mechanism that allows a function to return multiple values, and Go prides itself on its orthogonal features, so of course you can do that. Also handy for swapping: "x, y = y, x". Go isn't always more verbose than other languages...