package main import "fmt" //全局匿名函数 var ( Func = func(w1 int, w2 int) int { return w1 + w2 } ) func main() { //局部匿名函数,匿名函数赋值 res := func(s1 int, s2 int) int { return s1 + s2 }(10, 20) //传参给匿名函数 rel := res / 2 //调用结果 fmt.Println(rel) x := func(x1 int, x2 int, x3 int) int { return x1 - x2 - x3 } ss := x(93, 657, 53) fmt.Println(ss) }