← Back to archive

Stdle #14 · slices · 2026-06-20

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, 4}
a := s[0:2]
b := s[1:3]
a[1] = 9
fmt.Println(b)
}
Slices
4 attempts left

Answer & explanation