Comments
A comment is a note inside a procedure. Comments are very useful for documenting how a procedure works, what the variables are for, what the procedure parameters are, etc. Comments are totally optional, but you should use them to record anything you think you might forget about the operation of a procedure. Panorama has three different comment styles: /* … */, //, and ;.

`/*` … `*/` comments begin with `/*` and end with `*/`. The advantage of this type of comment is that a single comment may be many lines long. You can also use this type of comment within a formula.

`//` comments begin with `//` and continue to the end of the line.

`;` comments begin with a semicolon and continue to the end of the line.

A comment can appear almost anywhere in a procedure. The only restriction on comments is that they cannot be inside the middle of a statement or in most cases a formula; they must be between statements. The `/*` … `*/` comments, however, can be used within a formula as in this example:

    message "Now is the "+"time for all"/*+upper(" good")*/+" men." ☞ "Now is the time for all men."

Note: C-style comments can be nested, so this is a valid comment:

    /* This is a comment /* with another comment inside */ that's all folks */

This example shows a procedure with lots of comments of different styles. If anyone comes back and takes a look at this procedure next year, they will have no problem telling what the procedure does and how it does it.

    /* Procedure: .Delay
    This procedure delays for a fairly precise time.
    The procedure has one parameter, the number of seconds to delay.
    Example:
      call .Delay,12; delay for 12 seconds
    */
    local startTime
    startTime=now()// record the time we started
    loop
        nop ; short delay
    until now()>startTime+parameter(1)

“Commenting Out” Statements

One handy use for `/*` … `*/` comments is to temporarily remove one or more statements from a procedure (usually for testing purposes). Simply put `/*` and `*/` around the statement or statements you want to remove, and those statements are effectively removed from your procedure without actually erasing them. (Programmers call this “commenting out” the statements, because they are temporarily “out” of the program.) Since Panorama allows C-style comments to be nested, this will even work if the code you are commenting out contains C-style comments. To re-enable the statements simply remove the /* and */. You can also temporarily remove a single line of code by putting `//` (or `;`) at the beginning of the line.

Important note: If your code contains a single /* without a matching */, everything after the /* will be commented out.

History

Version | Status | Notes
10.0 | No Change | Carried over from Panorama 6.0.