You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ChocoPy/pa2-tests/core/bad_local_assign.py

24 lines
293 B

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)