Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 722 Bytes

adding_comments.md

File metadata and controls

28 lines (19 loc) · 722 Bytes

Adding Comments

We can add some texts that do not change the compiler behavior to our code. These texts are called comments.

Basically, there are two types of comments. One type of comments starts from // and ends at a line break symbol. The other type starts from /* and ends at */.

Here is an example of the comments:

/*
    This is an example program.
    It prints "Hello, world!".
*/

// This is the entrance function.
fn main() { // The code starts here.

    println!("Hello, world!"); // This statement prints "Hello, world!" on the screen.
    
} // The code ends here.

➡️ Next: Printing Strings

📘 Back: Table of contents