error nonlocal example
This commit is contained in:
parent
c8bb84641a
commit
d13ec5b03b
11
python-temel/nonlocal.ust.fonksiyon.py
Normal file
11
python-temel/nonlocal.ust.fonksiyon.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
x = 10
|
||||
|
||||
def foo():
|
||||
global x
|
||||
x = 20
|
||||
def bar():
|
||||
#nonlocal x # error, x üst fonksiyonda global
|
||||
x = 30
|
||||
bar()
|
||||
foo()
|
||||
print(x)
|
11
python-temel/nonlocal.ust.fonksiyon.py~
Normal file
11
python-temel/nonlocal.ust.fonksiyon.py~
Normal file
|
@ -0,0 +1,11 @@
|
|||
x = 10
|
||||
|
||||
def foo():
|
||||
global x
|
||||
x = 20
|
||||
def bar():
|
||||
nonlocal x # error, x üst fonksiyonda global
|
||||
x = 30
|
||||
bar()
|
||||
foo()
|
||||
print(x)
|
Loading…
Reference in New Issue
Block a user