mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-01 19:44:44 +00:00
fixes #1418
This commit is contained in:
33
tests/controlflow/tbreak.nim
Normal file
33
tests/controlflow/tbreak.nim
Normal file
@@ -0,0 +1,33 @@
|
||||
discard """
|
||||
output: '''10'''
|
||||
"""
|
||||
|
||||
var
|
||||
x = false
|
||||
run = true
|
||||
|
||||
while run:
|
||||
run = false
|
||||
block myblock:
|
||||
if true:
|
||||
break
|
||||
echo "leaving myblock"
|
||||
x = true
|
||||
doAssert(x)
|
||||
|
||||
# bug #1418
|
||||
iterator foo: int =
|
||||
for x in 0 .. 9:
|
||||
for y in [10,20,30,40,50,60,70,80,90]:
|
||||
yield x + y
|
||||
|
||||
for p in foo():
|
||||
echo p
|
||||
break
|
||||
|
||||
iterator permutations: int =
|
||||
yield 10
|
||||
|
||||
for p in permutations():
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user