0
Why do we have to use a single and multi- line comment when we can just use multi line?
someone pls help.
2 Respostas
+ 1
Single line comments are faster to type as you don't have to type the ending. When trying to find a bug, many times you modify your code and want to comment our the rest of the line without losing your original code. You'll be using it a lot.
Also it's the issue of nested comments. Some compilers are not smart enough to handle multiline inside multiline comments. You need this for example, to comment out a large chunck of code that happens to have also more comments inside.
+ 1
single line comments are good when you want to add a comment to the end or in the middle of line of codes. They are also faster.
Multi line comments are best for when you have a large comment to write, like when you want to explain what a function/method does. If you use Java, you will learn about JavaDoc comments which are very similar.