Closures 1

func scope() func() int{
    outer_var := 2
    foo := func() int {return outer_var}
    return foo
}
// Outpus: 2
fmt.Println(scope()())
Comments