funcmain(){ Print(1,"hello",55.9) } //表示可以传任意值 funcPrint(args...interface{}){ for_,res:=rangeargs{ switchres.(type){ caseint: fmt.Println(res,"isint") casefloat64: fmt.Println(res,"isfloat64"); casestring: fmt.Println(res,"isstring") } } }
funcmain(){ Print(1,"hello",55.9) } //表示可以传任意值 funcPrint(args...interface{}){ for_,res:=rangeargs{ switchres.(type){ caseint: fmt.Println(res,"isint") casefloat64: fmt.Println(res,"isfloat64"); casestring: fmt.Println(res,"isstring") } } }