📜  切换类型 golang - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:04.094000             🧑  作者: Mango

代码示例1
var value interface{} = "Hello Grepper"
switch vale.(type){
    case string:
        fmt.Println("It is a string")
    case int:
        fmt.Println("It is a int")
    default:
        fmt.Println("Not sure")
}