package main
import "fmt"
type Animal struct {
Name string
Age int
Species string
Weight float64
}
type Fruit struct {
Name string
Taste string
Smell string
}
func PrintName(thing any) {
fruit := thing.(Fruit)
if ok {
fmt.Println("Name", fruit)
} else {
fmt.Println("I can't print that")
}
}
func main() {
// this will work
durian := Fruit{"Durian", "Heaven", "Dead bodies and onions."}
PrintName(durian)
// this will fail
joey := Animal{"Joey", 3, "Kangaroo", 100.0}
PrintName(joey)
}