Hello all,

I've just tried to use a "nonlocal MyVar" statement in a procedure 
defenition, but it throws an error saying "Syntax error: no binding for 
nonlocal 'MyVar' found.

According to platform.python_version() I'm running version 3.8.3

Why am I getting that error ? (already googeled ofcourse)

Testcode:
- - - - - - - - - - - -
Def Proc1()
    nonlocal MyVar
    MyVar = 5

MyVar = 7
Proc1()
print(MyVar)
- - - - - - - - - - - -
I've also tried moving "MyVar = 7" to the first line, but that doesn't 
change anything.  Using "global MyVar" works..

Regards,
Rudy Wieser



-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to