+ 1

The difference b/w single line comment & multi line comment.?

12th Mar 2018, 3:06 AM
Yash Pal
Yash Pal - avatar
2 ответов
+ 4
My problem with multi-line comments is people do forget to close them or delete the close accidentally. Then, code will not run as it is within a bigger comment. That can't happen with single line comments. They automatically close at the end of the line. int x = 5; /* Example comment x += 2; /* Second comment */ // x is still 5, but a quick look might convince you it is 7. I've spent many hours tracking down these types of errors.
12th Mar 2018, 3:24 AM
John Wells
John Wells - avatar
0
Single line comment you have to comment every line but don't have to close the comment. Multi line comment you open and close a block of lines within your comment.
12th Mar 2018, 3:21 AM
Duncan
Duncan - avatar