go-tour/empty-interface.go
2020-02-08 16:39:18 -06:00

19 lines
212 B
Go

package main
import "fmt"
func main() {
var i interface{}
describe(i)
i = 42
describe(i)
i = "hello"
describe(i)
}
func describe(i interface{}) {
fmt.Printf("(%v, %T)\n", i, i)
}