Skip to content

Instantly share code, notes, and snippets.

@qezz
Created August 10, 2017 20:55
Show Gist options
  • Save qezz/ff34d331bd550dd0ce83d6f5222ebc46 to your computer and use it in GitHub Desktop.
Save qezz/ff34d331bd550dd0ce83d6f5222ebc46 to your computer and use it in GitHub Desktop.
def positive_counter():
x = 0
def tick():
nonlocal x
print(x)
x += 1
return tick
c = positive_counter()
for i in range(10):
c()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment