I am using env python 3.8.2 I can't get the value var in return
def a(x):
def b():
nonlocal x
if x>2:
print(x)
return x
x = x + 1
b()
return b
print(a(1)())
The result I am getting is:
4
None
I want to return value of x, but actually, it is None, even though the value printed is 4