← Back to archive

Stdle #130 · slices · 2026-10-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 := []int{1, 2, 3}
s = append(s, 4)
fmt.Println(s, len(s), cap(s))
}
Slices
4 attempts left

Answer & explanation