企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持知识库和私有化部署方案 广告
### 函数类型 函数类型的作用是可以体现程序的多态性 ~~~ type count func(int, int) int func Add(a, b int) int { return a + b } func Minus(a, b int) int { return a - b } func main() { var callCount count callCount = Minus fmt.Println(callCount(2, 1)) callCount = Add fmt.Println(callCount(2, 1)) } ~~~ ~~~ 1 3 ~~~