summary refs log tree commit diff stats
path: root/tests/iter/t338.nim
blob: dbced8b600236bca6fd75181fe6fef8603361d51 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
discard """
  output: '''0
1
2
3
4
'''
"""

proc moo(): iterator (): int =
  iterator fooGen: int {.closure.} =
    while true:
      yield result
      result.inc
  return fooGen

var foo = moo()

for i in 0 .. 4:
  echo foo()