← Back to archive

Stdle #139 · slices · 2026-10-23

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, 1, 1)
fmt.Println(len(s), cap(s))
s = append(s, 0)
fmt.Println(len(s), cap(s))
}
Slices
2 lines
4 attempts left

Answer & explanation