代码演示案例
package main import ( "fmt" ) func TypeCheck(items... interface{}){ for _,item:=range items { switch item.(type) { case bool : fmt.Println("this is bool"); case string: fmt.Println("this is string"); case int: fmt.Println("this is int"); default: fmt.Println("not know params Type"); } } } func main() { TypeCheck(true,"sdfdsds",10); }