```go
for k, v := range gobook2 {
switch v2 := v.(type) {
case string:
fmt.Println(k, "is string", v2)
case int:
fmt.Println(k, "is int", v2)
case bool:
fmt.Println(k, "is bool", v2)
/*case []interface{}:
fmt.Println(k, "is an arry: ")
for i, iv := range v2 {
fmt.Println(i, iv)
}*/
default:
fmt.Println(k, "is another type not handle yet")
}
}
```
这是结果:
IsPublished is bool true
Price is another type not handle yet
Title is string Golang programming
Authors is another type not handle yet
Publisher is string ituring.com.cn
我想问:v2到底是个什么东西?
有疑问加站长微信联系(非本文作者)