mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
16 lines
297 B
Nim
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"
|