How to understand the last function?
Why do we use different function names after func declaration?
How to use those function? Using it like shown in the main function is wrong.
package main
import (
"fmt"
)
func main() {
fmt.Println(incrementer()) //error
}
func incrementer() func() int { //what is it?!
i := 0
return func() int {
i++
return i
}
}