Files
pplus-library/mojo/stress/block-scope.mojo
T
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

21 lines
573 B
Mojo

# probe: var shadowing inside if and loop blocks
# status: the expected output is Programming+'s interpreter's prediction; corpus.py verify confirms or refutes it on godbolt
# expect-stdout: inner 11
# expect-stdout: outer 1
# expect-stdout: loop 0
# expect-stdout: loop 100
# expect-stdout: loop 200
# expect-stdout: total 0
def main():
var x = 1
if x == 1:
var x = 10
x += 1
print("inner", x)
print("outer", x)
var total = 0
for i in range(3):
var total = i * 100
print("loop", total)
print("total", total)