summary refs log tree commit diff stats
path: root/tests/iter/titervaropenarray.nim
blob: 1e70ce24738230f37c0900d0cc505e9e6c7fb25a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
discard """
  file: "titer2.nim"
  output: "123"
"""
# 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