tmultiline_comments.nim 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. discard """
  2. output: '''3'''
  3. """
  4. proc main* =
  5. ##[Mutltie akdlsf comment with #[nesting].
  6. Yay, that is so cool.
  7. ]##
  8. echo "foo bar"
  9. for s in ["one", "two", #["three",]# "four"]:
  10. echo s
  11. var foo #[ Test the new inline comments ]#: int = 3
  12. ##[ A
  13. novel documentation comment
  14. #[Nesting works to some extend]
  15. ##[ Nested doc comment! ]##
  16. ]#
  17. ]##
  18. echo $foo
  19. #[Comment here.
  20. Multiple lines
  21. are not a problem.]#
  22. #[ #[ Multiline comment in already
  23. commented out code. ]#
  24. proc p[T](x: T) = discard
  25. ]#
  26. proc bar =
  27. ##[Long documentation comment
  28. here.
  29. ]##
  30. proc write(a: auto, x: varargs[string, `$`]) =
  31. stdout.write ($a)
  32. for o in x:
  33. stdout.write(o)
  34. proc writeln(a: auto, x: varargs[string, `$`]) =
  35. write a, x
  36. stdout.write "\n"
  37. proc write() = write(stdout)
  38. proc writeln() =
  39. stdout.write "\n"
  40. #[ #[ Multiline comment in already
  41. commented out code. ]#
  42. proc p[T](x: T) = discard
  43. ]#
  44. var hello = #[(x in bar)^^ "Hello" # greetings
  45. ]#"Hello"
  46. proc maino =
  47. write hello, " Test Me "
  48. writeln()
  49. write 3
  50. block:
  51. write()
  52. write " times more"
  53. #[ test ]# writeln " Again"