python-CSD-kursu/python-temel/nonlocal.ust.fonksiyon.py

12 lines
177 B
Python
Raw Normal View History

2023-06-04 21:04:56 +03:00
x = 10
def foo():
global x
x = 20
def bar():
#nonlocal x # error, x üst fonksiyonda global
x = 30
bar()
foo()
print(x)