forked from M-Labs/nac3
David Mak
e0de82993f
Previously, the final value of the target expression would be one after the last element of the loop, which does not match Python's behavior. This commit fixes this problem while also preserving the last assigned value of the loop beyond the loop, matching Python's behavior.
15 lines
305 B
Python
15 lines
305 B
Python
# For Loop using an range() expression as its iterable, additionally reassigning the target on each iteration
|
|
|
|
@extern
|
|
def output_int32(x: int32):
|
|
...
|
|
|
|
def run() -> int32:
|
|
i = 0
|
|
for i in range(10):
|
|
output_int32(i)
|
|
i = 0
|
|
output_int32(i)
|
|
output_int32(i)
|
|
return 0
|