func main() {
Print(1, "hello", 55.9)
}
// 表示可以传任意值
func Print(args ...interface{}) {
for _, res := range args {
switch res.(type) {
case int :
fmt.Println(res, " is int")
case float64 :
fmt.Println(res, " is float64");
case string :
fmt.Println(res, " is string")
}
}
}
有疑问加站长微信联系(非本文作者)
