titervaropenarray.nim 286 B

1234567891011121314151617
  1. discard """
  2. file: "titer2.nim"
  3. output: "123"
  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