2 ms·
True. But the IDE can of course help. In WebStorm I can select multiple lines of code and press Ctrl-/ to have them all turned into single-line comments if th
by galaxyLogic 5y ago
True. But the IDE can of course help. In WebStorm I can select multiple lines of code and press Ctrl-/ to have them all turned into single-line comments if they were not, and uncomment them if they were.
Single-line comments have the benefit that it is always clear to the reader which lines are comments. Whereas if you use multi-line comments to comment a large section of code it is no longer clear when reading it whether it is indeed "inside" a comment.
And finally having both types of comments available is useful because you can multi-line-comment a section which already contains // -comments, whereas you can not multi-line comment a section which already contains multi-line comments.
- dylan604 5y agoCommenting a comment is still a comment. // => //// ////////////////////////////////////////////////////////////// // just like those devs that like to decorate their code with ////////////////////////////////////////////////////////////// /* * type of stuff */ Edit: almost forgot my shell friends ######################## ## works too ########################
- galaxyLogic 5y ago> Commenting a comment is still a comment But what about the below, does it work in your language? I assume it may work in some languages but not all. /* let a = 1; /* a is one */ let b = 2; */
- dylan604 5y agoI can definitely see where that could cause some issues. Personally, I don't like the /**/ style comments either. I was just playing devil's advocate.