← Back to archive

Stdle #69 · slices · 2026-08-14

What does this Go snippet output?

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

package main
import "fmt"
func main() {
s := make([]int, 0, 1)
s = append(s, 1)
s = append(s, 2)
fmt.Println(len(s), cap(s))
}
Slices
4 attempts left

Answer & explanation