summary refs log blame commit diff stats
path: root/tests/iter/titer9.nim
blob: 99874e70ad0157ea962af359d64a72ba831785cc (plain) (tree)
1
2
3
4
5
6
7





              
                                                      





                      
                                                       



                  
                    
 
discard """
  output: '''5
14
0'''
"""

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

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

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

takeProc(count[int])