当我定义函数时
func test(a int, b int) int {
//bla
}
我必须设置参数和返回值类型。我如何根据参数类型返回值,例如
func test(argument type) type {
//if argument type == string, must return string
//or else if argument int, must return integer
}
我可以这样做吗?
人到中年有点甜
森林海
随时随地看视频慕课网APP
相关分类