Multiline comments
Starting with version 0.13.0 of the language Nim supports multiline comments. They look like:
#[Comment here.
Multiple lines
are not a problem.]#
Multiline comments support nesting:
#[ #[ Multiline comment in already
commented out code. ]#
proc p[T](x: T) = discard
]#
Multiline documentation comments also exist and support nesting too:
proc foo =
##[Long documentation comment
here.
]##
You can also use the discard statement together with triple quoted string literals to create multiline comments:
discard """ You can have any Nim code text commented
out inside this with no indentation restrictions.
yes("May I ask a pointless question?") """
This was how multiline comments were done before version 0.13.0, and it is used to provide specifications to testament test framework.
当前内容版权归 nim-lang.org 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 nim-lang.org .