Files
Nim/tests/iter/titervaropenarray.nim
Timothee Cour 7e1ae35195 testament: error instead of silently ignore invalid targets; remove pointless alias target vs targets; document matrix; DRY (#16343)
* testament: error instead of silently ignore invalid targets
* s/target/targets/
* fix test; refs #16344
* address comments
* Update testament/specs.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2020-12-14 10:58:29 +01:00

16 lines
297 B
Nim

discard """
output: "123"
targets: "c"
"""
# Try to break the transformation pass:
iterator iterAndZero(a: var openArray[int]): int =
for i in 0..len(a)-1:
yield a[i]
a[i] = 0
var x = [[1, 2, 3], [4, 5, 6]]
for y in iterAndZero(x[0]): write(stdout, $y)
#OUT 123
write stdout, "\n"