Hapter, Omments – Teledyne LeCroy CATC Scripting Language Reference Manual User Manual

Page 20

Advertising
background image

C

HAPTER

5

Comments

CATC Scripting Language for USB

16

C

HAPTER

5: C

OMMENTS

Comments may be inserted into scripts as a way of documenting what the script
does and how it does it. Comments are useful as a way to help others understand
how a particular script works. Additionally, comments can be used as an aid in
structuring the program.

Comments in CSL begin with a hash mark (#) and finish at the end of the line. The
end of the line is indicated by pressing the Return or Enter key. Anything contained
inside the comment delimiters is ignored by the compiler. Thus,

# x = 2;

is not considered part of the program. CSL supports only end-of-line comments,
which means that comments can be used only at the end of a line or on their own
line. It's not possible to place a comment in the middle of a line.

Writing a multi-line comment requires surrounding each line with the comment de-
limiters

# otherwise the compiler would try to interpret

# anything outside of the delimiters
# as part of the code.

The most common use of comments is to explain the purpose of the code immedi-
ately following the comment. For example:

# Add a profile if we got a server channel
if(rfChannel != "Failure")
{

result = SDPAddProfileServiceRecord(rfChannel,

"ObjectPush");

Trace("SDPAddProfileServiceRecord returned ",

result, "\n");
}

Advertising