+ 8
The compiler ignores everything that appears in the comment, so why should i use them?
42 Respostas
+ 28
it's for documentation, when you're working on the same program you may forget what some part of the code does, so you should comment it.
And if aren't working alone you should comment so your teamates understand what you did
+ 11
Cezar got it right. Still, there are some dos and don'ts of how to make *good* comments:
* make them short and descriptive
* don't state the obvious
* don't renarrate the code
Anyone want to add a point?
+ 11
you see...on professional level...one project is collection of millions of source files...and they are made by thousands of workers...so lets say if you write a 100 line code to calculate some formula...and some other guy needs to understand it FAST so you add comments...instead of reading the whole code...a 1 line comment can specify the porpouse of the whole code...
+ 2
so helpul,tnq,im not very professional but im in the way ;)
+ 2
jst to make our program more user friendly and informative
+ 2
Comments are used to help another human to understand what the code does. That can be important if multiple people work on a single project together.
+ 2
since you are developing a program writing comments will help you and also the person who executes it other than you can easily. understand the programming and the logic which you used....
+ 2
Sometimes it's better to clarify what we are doing and where. Because once we go on with bigger programs we can't distinguish things. So, prevention is better than again debugging and revising. Providing Comments also helps to outsiders(who has not programmed) to grasp the code.
+ 2
You definitely understand how much comments will help you when you're going to develop a advanced programme
+ 2
To understand what code u wrote when the program is finished. It is also very helpful when working in team for a project. It is a good habit to write COMMENTS
+ 1
totally agree, Stefan :)
+ 1
Maybe you want to add something, Sardor? :-)
+ 1
Nastaran, maybe you are interested in rephrasing your question a little? It might be a bit hard to understand for other beginners what you actually wanted to know.
I say this in good faith, I'm trying to improve the "learning material" in the forum. Maybe it's worth it :-)
+ 1
ur right mr stephan,but im not very good at engish,by the way i try to improve mysefl next time ;)
+ 1
check it again,better now or just waste the time?! :)))
+ 1
Thank you Nastaran, this has been a positive experience through and through. :-)
+ 1
Try to find in your memory the most complicated algorithm or program you ever made. Was it hard to do? I believe it was. After a few weeks you probably forgot the details. Using comments let you know how it works without making it again, step by step in your head whenever you look at your code. Remember that your future projects will be more and more complicated.
Also if you would like to show it to someone else it is easier for him to read the comments than to analyse all the code.
+ 1
because it help to understand the code you writen to someone who read your code
+ 1
for some the sudo code turns into the commets/documentation
+ 1
صبر داشته باش دختر، در ادامه کسب تجربه برنامه نویسی بهش نیاز پیدا می کنی!