What is the use of documentation comments | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is the use of documentation comments

/** and */ what is this

29th Mar 2018, 10:13 AM
Baskaran Panneerselvam
1 Answer
+ 5
Comments shouldn't be the substitute for a way to explain poorly written code in English. Write well structured and readable code, and then use comments. Some believe that code should be self-documenting and comments should be scarce. However, I have to disagree with it completely (It's my personal opinion). There is nothing wrong with using comments to explain complex algorithms, regex or scenarios where you have chosen one technique over other (for future reference) to solve the problem. In most cases, use comments to explain 'why' rather than 'how' and you are good to go.
29th Mar 2018, 11:28 AM
Baraa AB
Baraa AB - avatar