Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

closures in python

def make_counter():

    count = 0
    def inner():

        nonlocal count
        count += 1
        return count

    return inner
Source by zetcode.com #
 
PREVIOUS NEXT
Tagged: #closures #python
ADD COMMENT
Topic
Name
1+7 =