-2
Past until today, I always made a mistake, I still don’t understand anything because it didn’t work. Someone can explain?
I’ll use a code example:
def test(x, y):
if x == y:
v1 = False
else:
v1 = True
return v1
test(3,3)
if v1 == True:
print("OK")
Appeared like this:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-28-11958f52b994> in <module>
6 return v1
7 test(3,3)
----> 8 if v1 == True:
9 print("OK")
NameError: name 'v1' is not defined
I tried to use "Return", but it seems that "Return" does not serve anything.