titervaropenarray.nim 282 B

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