Comments
Motoko supports single-line, multi-line, and nested comments.
Single line
Use //
for comments that extend to the end of a line.
// This is a single-line comment
Use ///
for function or module documentation (also known as "doc comments"). Module documentation can be exported into documentation files such as Markdown or HTML using mo-doc.
/// Returns the sum of two integers.
func add(a : Int, b : Int) : Int {
a + b
}
Multi-line
Use /* ... */
for block comments spanning multiple lines.
/* This is a
multi-line comment */
Nested
Multi-line comments can be nested within each other.
/* Outer comment
/* Nested comment */
End of outer comment */