0

Does anyone know the point of a comment if it wont even be executed?

19th Nov 2016, 10:19 PM
Anthony
Anthony  - avatar
6 Réponses
+ 7
It's useful to explain to everyone with words what your code does ;)
19th Nov 2016, 10:24 PM
Silvia
Silvia  - avatar
+ 5
It improves the readability of your code for yourself and others. You may forget what a certain line may do. A comment will fix that. It can be applied in the same way when others view your code.
19th Nov 2016, 10:43 PM
Ben
Ben - avatar
+ 4
You can also use it to "comment out" lines in code: If you want to temporarily remove a line of code, place it in a comment. This way, to add back the line of code, you can just remove the comment.
20th Nov 2016, 7:14 AM
Samuel Neo
Samuel Neo - avatar
+ 2
Legal notices, like copyrights When you can't use a function name to explain something Your intent behind a decision Clarification of code you can't alter, like library call results Warning of consequences TODOs (to a reasonable degree) Amplify the importance of something seemingly inconsequential Javadocs in public APIs simply it used to explain with words what ur codes say 😀😇 good luck in programming ❤☺😉
23rd Nov 2016, 6:09 PM
Baraa AB
Baraa AB - avatar
+ 1
it helps yourself and others get a better understandin of your code,once the code become long and complicated, even its you who wrote the code, it still can be hard to understand what does every line exactly do, this is when the comments are necessary, to help debug or ameliorate the program.(sorry English is my seclang,so please correct me if theres any mistake)
23rd Nov 2016, 10:30 PM
seamond
seamond - avatar
+ 1
In addition to documenting code function, you can also use commenting as a sort of switch; I.E."commenting out" certain functions or configurations. It helps with debugging too.
20th Dec 2016, 8:56 PM
Robert Jones
Robert Jones - avatar