nonlocal example 2
This commit is contained in:
parent
a5d6ac70f4
commit
c6f5c580a3
|
@ -0,0 +1,10 @@
|
|||
def foo():
|
||||
x = 10
|
||||
def bar():
|
||||
def tar():
|
||||
nonlocal x # foo'daki x
|
||||
x = 20
|
||||
tar()
|
||||
bar()
|
||||
print(x) # 20
|
||||
foo()
|
Loading…
Reference in New Issue