Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function! Foo()
- let x = 0
- function! Bar() closure
- let x += 1
- return x
- endfunction
- return function('Bar')
- endfunction
- let Count = Foo()
- echo Count()
- " => 1
- echo Count()
- " => 2
- echo Count()
- " => 3
- let Count2 = Foo()
- echo Count()
- " => 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement