From 46a68fe919025cb9fb2b49a79ca4049dc4a74f4d Mon Sep 17 00:00:00 2001 From: Kennedy Richard Date: Sun, 6 Apr 2025 10:45:29 -0300 Subject: [PATCH] add example to comment.md Block comments allow people to uncomment/comment a whole code block by adding/removing a single '/' character. None of the existing examples clearly demonstrates this ability, so I thought it'd be useful to do so here. The chapter is already very small, so adding a few extra lines should be acceptable. --- src/hello/comment.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/hello/comment.md b/src/hello/comment.md index 4ea6dcd44f..5fa2afb234 100644 --- a/src/hello/comment.md +++ b/src/hello/comment.md @@ -34,6 +34,19 @@ fn main() { no actual need for it. */ + // Here's another powerful use of block comments: you can uncomment + // and comment a whole block by simply adding or removing a single + // '/' character: + + /* <- add another '/' before the 1st one to uncomment the whole block + + println!("Now"); + println!("everything"); + println!("executes!"); + // line comments inside are not affected by either state + + // */ + // You can manipulate expressions more easily with block comments // than with line comments. Try deleting the comment delimiters // to change the result: