Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Closures are functions that return anonymous functions
- func demo() func() int {
- out := 0
- return func() int {
- out++
- return out
- }
- }
- ...
- test := demo()
- val := test() // 0
- val() // 1
- val() // 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement