Skip to main content

Comments

·137 words·1 min
Documentation - This article is part of a series.
Part 8: This Article

Single Line Comments
#

Single line comments are created with //. Anything after // on a line is ignored by the compiler.

// This is a comment
let a = 5; // This is another comment
println(a); // This is a third comment
Output:
5

Multi Line Comments
#

Multi line comments are created with /* and */. Anything between /* and */ is ignored by the compiler.

/* This is a comment
   that spans multiple lines */
let a = 5;
println(a);
Output:
5

Nested Comments
#

Sage allows nested comments, which can be useful for commenting out large blocks of code.

/* This is a comment
   /* that is nested */
   // This is a nested single line comment in a block comment
   and spans multiple lines */
let a = 5;
println(a);
Output:
5
Documentation - This article is part of a series.
Part 8: This Article