← Back to archive

Stdle #153 · slices · 2026-11-06

What does this Go snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

package main
import "fmt"
func main() {
s := []int{}
for i := 0; i < 3; i++ {
s = append(s, i)
}
fmt.Println(len(s), cap(s))
}
Slices
4 attempts left

Answer & explanation