Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. function! Foo()
  2. let x = 0
  3. function! Bar() closure
  4. let x += 1
  5. return x
  6. endfunction
  7. return function('Bar')
  8. endfunction
  9.  
  10. let Count = Foo()
  11. echo Count()
  12. " => 1
  13. echo Count()
  14. " => 2
  15. echo Count()
  16. " => 3
  17.  
  18. let Count2 = Foo()
  19. echo Count()
  20. " => 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement