views
Determine which type of comment you want to add. Programmers have several different main purposes for comments that determine the exact format and style of what will be included in the comment. Consider code module comments. Module comments are higher-level comments that usually describe the overall purposes of the code module, as well as other information like copyright, authorship and more. Assess the need for procedure comments. Various functional code procedures should also be commented. Procedure comments relate to the specific functions of code, and they help to alert other programmers about the exact results of a procedure according to how it is written.
Choose detailed categories of use for your code comments. Some types of comments, like procedure comments, also come in different forms. Understand these different uses in order to add the right kinds of comments to your program. Assess the use of purpose comments for procedures. These describe what the procedure does. Consider the use of function return value comments. These will help others to understand what values are returned by procedure. Include conditional comments. Conditional comments can describe possible error conditions and error handling, as well as conditions that must be met for code to work properly.
Choose a format for comments. There's also the issue of how you will add comments to specific lines of code. Utilize left-handed comments. These comments start at the left of the screen and continue the whole way across a line. Commonly, the coder needs to arbitrarily end the comment near the right side of the screen, go down to a new line and continue the comment. Use in-line comments. In-line comments have an apostrophe directly after a piece of code and are placed on the same line.
Use an apostrophe to mark the beginning of your comments. This is the key step for actually writing comments into code. The apostrophe is the specific text protocol that the Visual Basic compiler recognizes for comments. Without this, the computer will try to read the comments as code.
Comments
0 comment