Skip to content

Commit 46a68fe

Browse files
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.
1 parent d5f826a commit 46a68fe

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/hello/comment.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,19 @@ fn main() {
3434
no actual need for it.
3535
*/
3636
37+
// Here's another powerful use of block comments: you can uncomment
38+
// and comment a whole block by simply adding or removing a single
39+
// '/' character:
40+
41+
/* <- add another '/' before the 1st one to uncomment the whole block
42+
43+
println!("Now");
44+
println!("everything");
45+
println!("executes!");
46+
// line comments inside are not affected by either state
47+
48+
// */
49+
3750
// You can manipulate expressions more easily with block comments
3851
// than with line comments. Try deleting the comment delimiters
3952
// to change the result:

0 commit comments

Comments
 (0)