This question already has an answer here:
The following go code:
var numbers4 = [...]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
slice := numbers4[4:6:8]
fmt.Printf("%d
", cap(slice))
Why is cap(slice)
equal to 4
?
I used to thought that should be 2
.
</div>