← Back to archive

Stdle #61 · interfaces · 2026-08-06

What does this Go snippet output?

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

package main
import "fmt"
type T struct{ N int }
func main() {
var i interface{} = T{5}
switch v := i.(type) {
case T:
fmt.Println(v.N)
default:
fmt.Println("?")
}
}
Interfaces
4 attempts left

Answer & explanation