← Back to archive

Stdle #80 · interfaces · 2026-08-25

What does this Go snippet output?

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

package main
import "fmt"
type ID int
func (id ID) String() string { return fmt.Sprintf("#%d", int(id)) }
func main() {
ids := []ID{1, 2}
fmt.Println(ids)
}
Interfaces
4 attempts left

Answer & explanation