0
Does anyone know the point of a comment if it wont even be executed?
6 Respuestas
+ 7
It's useful to explain to everyone with words what your code does ;)
+ 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.
+ 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.
+ 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 ❤☺😉
+ 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)
+ 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.