closure

Run Settings
LanguagePython
Language Version
Run Command
def a(): x = "python" def b(): print("I am from inner function {0}".format(x)) return b c = a() c() x = 100 def outer(): x = 1 def inner1(): nonlocal x # global x print("I am from inner function {0}".format(x)) x = x + 1 def inner2(): nonlocal x # x = x + 1 print("I am from inner2 function {0}".format(x)) x = x + 1 # inner2() # return inner1 return inner1,inner2 # c = outer() # c() c,d = outer() c() d() c() d()
Editor Settings
Theme
Key bindings
Full width
Lines