Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Block Comments are useful when making multiple line comments. When making a block comment, it begins with "/*" and ends with "*/". Everything in between these symbols is considered a comment. This is useful when you are testing and need to comment out a large block of code.

Code Block
/*
this is a comment
this is also a comment
string value = "even this line will be considered a comment";
*/

Line Comments

An Line Comment is great when commenting one line of code. A line comment is created with two forward slashes, "//". Everything after the double forward slashes is considered a comment for the rest of the line. For example:

Code Block
// this is a comment
string value = "string goes here"; // this is also a comment

"JavaDoc" Style Comments

If you look at the source code for silUnit, you will see how to properly create comments in your source code. Note the following:

  • A brief description of what the routine does.

  • A description of each parameter and a description of what each parameter represents.

...

Code Block
/**
* Lists all the files in a given directory tree. 
* @param dirName - The path of directory to search
* @param excludes - A list of directories or files to exclude from results
* @return The list of files found in the directory
*/
function directoryFiles(string dirName, string[] excludes) {
  // rest of routine here
}

Conclusion

For a complete explanation of commenting, see this Oracle page on commenting code.

...

Page Properties
hiddentrue

Related issues