← Back to archive

Stdle #155 · interfaces · 2026-11-08

What does this Go snippet output?

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

package main
import "fmt"
func kind(i interface{}) string {
switch i.(type) {
case bool:
return "bool"
case rune:
return "rune"
}
return "other"
}
func main() {
fmt.Println(kind('x'))
}
Interfaces
4 attempts left

Answer & explanation