WebSiphon 2 Guide: SiphonScript Comments
contents prev next

  1. Single Line Comments
  2. Multiple Line Comments

Using comments is an easy method of documenting what is going on in a script either for yourself or for others who may need to understand it later. Comments are not included with the HTML output, so documenting private information within comments is perfectly secure. Because comments may contain any character, you cannot begin an HTML block or end a script block within a comment.

Initially, many people who are new to using computer languages (scripting or otherwise) do not spend the time necessary to properly document their code using comments. Though it does take a bit of extra effort, it is well worth it in the long run when you are trying to decipher the mode of thought you were in while writing a script eight months ago!

Single Line Comments

Singe line comments in SiphonScript begin with // and extend until the end of the line. A single line comment is terminated with a carriage return, so if you need to include one within the comment use a multi-line comment instead.

Examples:

// This is a single-line comment.
// And this is another one.

appendLog("Hello!"); // This is a valid comment as well.
Multiple Line Comments

SiphonScript also supports multi-line comments. A multi-line comment begins with /* and is terminated with */. Any number of nested comments are supported using this method, and it is even possible to include a comment in the middle of any statement.

Examples:

/* This is a multi-line comment 
   example that is several 
   lines long.                  */
   
appendLog("Hello!" /* Here is another valid comment */ );

contents prev next

Copyright (c)1996-2003 Purity Software