Comments
Rust uses //
for line comments and /* */
for block comments:
// Line comment /* Block comment */
Multi-line comments require //
on each line:
// Multi-line comment // continues here
Comments can be placed at line end or above code:
fn main() { let lucky_number = 7; // I'm feeling lucky today }
fn main() { // I'm feeling lucky today let lucky_number = 7; }
Documentation comments (///
and //!
) are covered in Chapter 14.