You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
funcmain() {
varx []intx=append(x, 0) // explanation 1: new array created with capacity 2x=append(x, 1) // explanation 2: same array index 1 set to 1x=append(x, 2) // explanation 3: new array created with len 4, 012 setted// expected: [0 1 2 3 0 1 2 4]// wtf: [0 1 2 4 0 1 2 4]fmt.Println(append(append(x, 3), append(x, 4)...))
// explanation 4: no new arrays created, index 3 set to 3, and then to 4
}
The text was updated successfully, but these errors were encountered:
Understanding slices work
The text was updated successfully, but these errors were encountered: