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

iterator count(x: int, skip: bool): int {.closure.} =
  if skip: return x+10
  else: yield x+1

  if skip: return x+10
  else: yield x+2

proc takeProc(x: iterator (x: int, skip: bool): int) =
  echo x(4, false)
  echo x(4, true)
  echo x(4, false)

takeProc(count)