← Back to archive

Stdle #158 · slices · 2026-11-11

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, 2, 5)
t := append(s, 1)
s = append(s, 2)
fmt.Println(t)
}
Slices
4 attempts left

Answer & explanation