D.6 operators, Operators – Teledyne LeCroy Merlins Wand - Users Manual User Manual

Page 277

Advertising
background image

261

CATC M

ERLIN

S

W

AND

2.00

C

HAPTER

D

User’s Manual

CATC Scripting Language

};

If none of the first four expressions evaluates to true, then default will be
evaluated, returning a value of null for the entire expression.

select

expressions can also be used to conditionally execute statements,

similar to C switch statements:

select {

A == 1 : DoSomething();
A == 2 : DoSomethingElse();
default: DoNothing();

};

In this case the appropriate function is called depending on the value of A,
but the evaluated result of the select expression is ignored.

D.6 Operators

An operator is a symbol that represents an action, such as addition or
subtraction, that can be performed on data. Operators are used to manipulate
data. The data being manipulated are called operands. Literals, function
calls, constants, and variables can all serve as operands. For example, in the
operation

x + 2

the variable x and the integer 2 are both operands, and + is the operator.

Operations can be performed on any combination of value types, but will
result in a null value if the operation is not defined. Defined operations are
listed in the Operand Types column of the table on page 264. Any binary
operation on a null and a non-null value will result in the non-null value. For
example, if

x = null;

then

3 * x

will return a value of 3.

A binary operation is an operation that contains an operand on each side of
the operator, as in the preceding examples. An operation with only one
operand is called a unary operation, and requires the use of a unary operator.
An example of a unary operation is

Advertising