I'm still confused on the purpose of the comments, like is it necessary? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I'm still confused on the purpose of the comments, like is it necessary?

28th Jun 2016, 4:20 PM
Arthur
Arthur - avatar
5 Answers
+ 7
Comments are an important part of coding. They exist in every single language because they are so useful. They tell you and more importantly anyone else reading your code what it is, how it works, your thinking and even potential errors and pitfalls when editing. Un commented code is frowned upon by many. There are many schools of thought on commenting. However, the main two are: first comment everything. Good but hard to maintain. Second comment what things do ie blocks of code. be explicit not implicit. you can save commenting everything by using variable names that say what they are. variables like a n var1 will have you commenting till the cows come home. names like arrEmployees is much better.
28th Jun 2016, 7:29 PM
Keith Whatling
Keith Whatling - avatar
+ 2
they can be necessary for large pieces of code that may become confusing to make out, and they are very useful when you give your code to someone else for whatever reason so he may know what every code is for.
1st Jul 2016, 2:46 PM
‎أيوب المنتصر‎
+ 1
Comments makes the program easy to understand whenever another programmer checks on it.
29th Jun 2016, 2:19 PM
Muench Riel Macarasig
Muench Riel Macarasig - avatar
0
ok, thanks guys
29th Jun 2016, 2:20 PM
Arthur
Arthur - avatar
- 1
Yes. Exemple sometimes you forget what you did in your code, especially after long time you dont read it or it's a big file contents many lines of code
28th Jun 2016, 5:26 PM
Sait™
Sait™ - avatar