类型

类型判断
var a interface{}
a = "aaaa"
_, ok := a.(bool)
fmt.Println(ok)
a := "abc"
re := reflect.TypeOf(a).Kind()
if re == reflect.Bool {
    //TODO
}else{
    //TODO
}

results matching ""

    No results matching ""