Skip to content

Comments ​

Tyrus supports line and block comments. Comments are discarded by the lexer and do not affect semantic analysis or native code generation.

Line Comments ​

tyrus
// A line comment continues to the end of the current line.
const enabled: boolean = true;

Block Comments ​

tyrus
/* A block comment may span
   more than one physical line. */
const retries: u32 = 3;

Documentation Comments ​

Documentation comments attach structured text to declarations. The Language Server uses them in hover and completion.

tyrus
/**
 * Sends a welcome message.
 * @param email Destination e-mail address.
 * @returns true when the message was accepted.
 */
function sendWelcome(email: string): boolean {
    return email.includes("@");
}

Supported tags include @param, @returns, @deprecated, and @example.

Comments inside strings are text

Comment delimiters inside quoted strings and template literals are string content, not comments.

tyrus
const marker: string = "/* not a comment */";
const line: string = "// also not a comment";