How to Write a Comment in a Computer Programming Language
Understand the purpose of commenting a computer program., Think of a short, simple way to get across your point., Write the comment using the appropriate syntax given by the programming language. , Ask yourself if the comment you've written is...
Step-by-Step Guide
-
Step 1: Understand the purpose of commenting a computer program.
Readability is the key thing here.
When you look at a comment you should know that it is a comment and not a line of code.
The comment should also be helpful not just to you, but to anyone else that might read the source code of your computer program. -
Step 2: Think of a short
Comments don't need to be a work of art.
They should be concise, neat, and straight to the point.
This should not, however, discourage the use of multiple lines for a comment.
The point is that the information needs to get across to the reader. ,, A comment should be able to tell someone looking at the source code what that part of the program actually does without having to compile it and run it.
Does your comment accomplish this? Does it convey all the details? -
Step 3: simple way to get across your point.
-
Step 4: Write the comment using the appropriate syntax given by the programming language.
-
Step 5: Ask yourself if the comment you've written is detailed enough.
Detailed Guide
Readability is the key thing here.
When you look at a comment you should know that it is a comment and not a line of code.
The comment should also be helpful not just to you, but to anyone else that might read the source code of your computer program.
Comments don't need to be a work of art.
They should be concise, neat, and straight to the point.
This should not, however, discourage the use of multiple lines for a comment.
The point is that the information needs to get across to the reader. ,, A comment should be able to tell someone looking at the source code what that part of the program actually does without having to compile it and run it.
Does your comment accomplish this? Does it convey all the details?
About the Author
Sara Rivera
Specializes in breaking down complex hobbies topics into simple steps.
Rate This Guide
How helpful was this guide? Click to rate: