tvarargs.nim 303 B

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