Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust and comments

Both single-line and multi-line comments are available in Rust. Comments are also used to write user documentation. See the spec of comments for more details.

fn main() {
    println!("hello");
    // println!("Foo");

    /*
        This is a
        multiline comment
    */

    println!("world"); // comments
}

  • //
  • /* */