tvarargs.nim 324 B

12345678910111213141516171819
  1. discard """
  2. targets: "c js"
  3. matrix: "--gc:refc; --gc:arc"
  4. """
  5. import std/assertions
  6. template main =
  7. proc hello(x: varargs[string]): seq[string] =
  8. var s: seq[string]
  9. s.add x
  10. s
  11. doAssert hello() == @[]
  12. doAssert hello("a1") == @["a1"]
  13. doAssert hello("a1", "a2") == @["a1", "a2"]
  14. static: main()
  15. main()