Return a function and call it : Function type vars « Function « Python






Return a function and call it

Return a function and call it
def f1():
    x = 88
    def f2():
        print x
    return f2

action = f1()            # make, return function
action()                 # call it now: prints 88


           
       








Related examples in the same category