Skip to main content

Comments

Line Comments start with //. Everything after a // is ignored until the end of the line.

Block (multi-line) Comments start with /* and end with */. Block comments can be nested.

// This is a line comment

/* This is a block comment */

Documentation comments​

To indicate that a comment is part of the documentation and is formatted using markdown, use /// for single line comments and /** */ for block comments.

/// This is a documentation line comment

/** This is a documentation block comment */

A documentation comment written immediately before a function definition is attached to it as the function's description — markers stripped, /// lines joined, the * gutter of a block removed. It is what about(f) prints, what an editor hover shows. Markdown is the intended format.

/// Doubles its argument.
twice(x) = 2x