package main
import (
"fmt"
)
func main() {
f := func(i interface{}) {
switch t := i.(type) {
case bool:
fmt.Println("bool")
case int:
fmt.Println("int")
case string:
fmt.Println("string")
default:
fmt.Printf("type is = ", t)
}
}
f(12)
f(true)
f("golang")
f(false)
f(3.14)
}
/*
run:
int
bool
string
bool
type is = %!(EXTRA float64=3.14)
*/