A closure is a function that references variables from its surrounding scope, "closing over" them — the function retains access to those variables even after the enclosing function returns. Go functions are first-class values, making closures a common and powerful tool.
A basic closure
{
count :=
{
count++
count
}
}
counter := makeCounter()
fmt.Println(counter())
fmt.Println(counter())
other := makeCounter()
fmt.Println(other())
