Comments
Motoko supports single-line, multi-line, and nested comments.
Single line
Section titled “Single line”Use // for comments that extend to the end of a line.
// This is a single-line commentUse /// 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
Section titled “Multi-line”Use /* ... */ for block comments spanning multiple lines.
/* This is a multi-line comment */Nested
Section titled “Nested”Multi-line comments can be nested within each other.
/* Outer comment /* Nested comment */ End of outer comment */