titervaropenarray.nim 297 B

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