Created
August 10, 2017 20:55
-
-
Save qezz/ff34d331bd550dd0ce83d6f5222ebc46 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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