D.12 primitives, Primitives – Teledyne LeCroy Merlins Wand - Users Manual User Manual
Page 292

276
CATC M
ERLIN
’
S
W
AND
2.00
C
HAPTER
D
User’s Manual
CATC Scripting Language
add(1);
the parameter x will be assigned to 1, and the parameter y will be assigned
to null, resulting in a return value of 1. But if add is called with more than
two arguments
add(1, 2, 3);
x
will be assigned to 1, y to 2, and 3 will be ignored, resulting in a return
value of 3.
All parameters are passed by value, not by reference, and can be changed in
the function body without affecting the values that were passed in. For
instance, the function
add_1(x, y)
{
x = 2;
y = 3;
return x + y;
}
reassigns parameter values within the statements. So,
a = 10;
b = 20;
add_1(a, b);
will have a return value of 5, but the values of a and b won't be changed.
The scope of a function is the file in which it is defined (as well as included
files), with the exception of primitive functions, whose scopes are global.
Calls to undefined functions are legal, but will always evaluate to null and
result in a compiler warning.
D.12 Primitives
Primitive functions are called similarly to regular functions, but they are
implemented outside of the language. Some primitives support multiple
types for certain arguments, but in general, if an argument of the wrong type
is supplied, the function will return null.