summary refs log tree commit diff stats
path: root/tests/generics/tgenericlambda.nim
blob: f7aafe1d90eb4668f5e894518e77042d4f10810b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
discard """
  output: "10\n10\n1\n2\n3"
"""

proc test(x: proc (a, b: int): int) =
  echo x(5, 5)

test(proc (a, b): auto = a + b)

test do (a, b) -> auto: a + b

proc foreach[T](s: seq[T], body: proc(x: T)) =
  for e in s:
    body(e)

foreach(@[1,2,3]) do (x):
  echo x