Operators - Keithley 2601 Reference Manual

System sourcemeter 2600 series (smu)
Hide thumbs Also See for 2601:
Table of Contents

Advertisement

Section 2: TSP Programming

Operators

Arithmetic Operators:
(addition)
+
(subtraction)
-
(multiplication)
*
(division)
/
(negation)
-
Functions
TSL allows you to define functions. A function can take a predefined number of parameters and
return multiple parameters if desired.
Let's define a function and call it:
function add_two(parameter1, parameter2)
return(parameter1 + parameter2)
end
print(add_two(3, 4))
Below is an alternate syntax for defining a function. Functions are first-class values in TSL, which
means functions can be stored in variables, passed as arguments, and returned as results if
desired.
add_three = function(parameter1, parameter2, parameter3)
return(parameter1 + parameter2 + parameter3)
end
print(add_three(3, 4, 5))
Here is a function that returns multiple parameters; sum, difference, and ratio of the two numbers
passed to it:
function sum_diff_ratio(parameter1, parameter2)
psum = parameter1 + parameter2
pdif = parameter1 – parameter2
prat = parameter1 / parameter2
return psum, pdif, prat
end
sum, diff, ratio = sum_diff_ratio(2,3)
print(sum)
print(diff)
2-46
Series 2600 System SourceMeter® Instruments Reference Manual
Relational Operators:
(less than)
<
(greater than)
>
(less than or equal)
<=
(greater than or equal)
>=
(not equal)
~=
(equal)
==
Return to
Section Topics
Logical Operators:
and
or
not
2600S-901-01 Rev. C / January 2008

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

26362602261126122635

Table of Contents