Lambdas work as expected:
func main() {
inc := func(x int) int { return x+1; }
}
However, the following declaration inside a declaration is not allowed:
func main() {
func inc(x int) int { return x+1; }
}
For what reason are nested functions not allowed?
I think there are 3 reasons why this obvious feature isn't allowed
Those are just my opinions though - I haven't seen an official pronouncement from the language designers.