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