This content originally appeared on DEV Community and was authored by xavier2code
fn main() {
// This is an example of a line comment.
// There are two slashes at the beginning of the line.
// And nothing written after these will be read by the compiler.
// println!("Hello, world!");
// Run it. See? Now try deleting the two slashes, and run it again.
/*
* This is another type of comment, a block comment. In general,
* line comments are the recommended comment style. But block comments
* are extremely useful for temporarily disabling chunks of code.
* /* Block comments can be /* nested, */ */ so it takes only a few
* keystrokes to comment out everything in this main() function.
* /*/*/* Try it yourself! */*/*/
*/
/*
Note: The previous column of `*` was entirely for style. There's
no actual need for it.
*/
// You can manipulate expressions more easily with block comments
// than with line comments. Try deleting the comment delimiters
// to change the result:
let x = 5 + /* 90 + */ 5;
println!("Is `x` 10 or 100? x = {}", x);
}
This content originally appeared on DEV Community and was authored by xavier2code
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
xavier2code | Sciencx (2024-11-05T02:34:54+00:00) Daily.rust day 2. Retrieved from https://www.scien.cx/2024/11/05/daily-rust-day-2/
" » Daily.rust day 2." xavier2code | Sciencx - Tuesday November 5, 2024, https://www.scien.cx/2024/11/05/daily-rust-day-2/
HARVARDxavier2code | Sciencx Tuesday November 5, 2024 » Daily.rust day 2., viewed ,<https://www.scien.cx/2024/11/05/daily-rust-day-2/>
VANCOUVERxavier2code | Sciencx - » Daily.rust day 2. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/11/05/daily-rust-day-2/
CHICAGO" » Daily.rust day 2." xavier2code | Sciencx - Accessed . https://www.scien.cx/2024/11/05/daily-rust-day-2/
IEEE" » Daily.rust day 2." xavier2code | Sciencx [Online]. Available: https://www.scien.cx/2024/11/05/daily-rust-day-2/. [Accessed: ]
rf:citation » Daily.rust day 2 | xavier2code | Sciencx | https://www.scien.cx/2024/11/05/daily-rust-day-2/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.