Files
ChocoPy/pa2-tests/core/bad_local_assign.py
T
2021-04-11 13:32:23 -04:00

24 lines
293 B
Python

x:int = 1
y:int = 2
z:int = 3
def foo(x:int) -> object:
y:int = 4 # OK
global z # OK
def qux() -> int:
y = 1 # Bad, nonlocal not declared
return 0
z = 1 # OK
pass
def bar(x:int) -> int:
z = 1 # Bad, global not declared
return x
foo(1)