Comments
Comment code with // or /* */.
Line comments
Everything after // is ignored until end of line.
// this is a comment
let x = 1 // after code
print(x)// this is a comment
let x: i32 = 1
print(x)Output
1
Block comments
/* ... */ spans multiple lines (non-nested).
/*
* file header
*/
let total = 1 /* mid-line */ + 2
print(total)/*
* file header
*/
let total = 1 /* mid-line */ + 2
print(total)Output
3