kuroko/test/testUpvalueClosureOnEarlyReturnOrLoopExit.krk

24 lines
343 B
Python
Raw Permalink Normal View History

let closures = []
for i in range(3):
let a
try:
a = 'bad'
closures.append(lambda: print(a))
continue
finally:
a = f'good {i}'
def foo():
let a
try:
a = 'bad'
closures.append(lambda: print(a))
return
finally:
a = 'good'
foo()
for i in closures:
i()