Comments in Code
All through this manual you will see examples of ViviFire code with comments.
Most of these comments start with an apostrophe (
') and stop at the end of the line.
You can also use two slashes (
//) as an alternative.
The ViviFire compiler ignores all Comments.
You put comments in your code to tell what other code does. And frequently they give other information.
There are two types of comments: the inline comment (given above) and the block comment. A block comment has two symbols that identify the start and end of a comment. Block comments can contain two or more lines. Although you can put block comments between elements in one line, it can make code not as easy to read.
There are two types of block comment.
The first starts with
/* and stops after
The second starts with
/' and stops after
' This is a full-line comment PrintLine "Test" ' This comment is inline with code PrintLine "Hi " & name _ ' This comment & " how are you?" ' is divided in two /' This is a short block comment '/ /* This is a long block comment that is divided across more than one line. */ Call Test 1 /'one'/, 2 /'two'/, 3 /'three'/
Recommended procedures for comments
The list that follows gives some general instructions about what type of comment can come before a section of code. These are only recommended procedures. Do what you think is necessary for you and all persons who will read your code.
- Tell what a procedure does, not how it does it.
- Make a list of each external variable, control, file, or other element to which a procedure must have access.
- Make a list of each changed external variable, control, or file, and the effect that it has (only if it is not clear).
- Tell what each argument gives to a procedure.
- Tell what a procedure returns.
Some more to think about:
- Try to write a comment before each important variable declaration that tells how you use it.
- Try to give good names to variables, controls, and procedures. Good names can make some comments shorter or not necessary.