Functions - Keithley 3700 series Reference Manual

System switch/multimeter
Hide thumbs Also See for 3700 series:
Table of Contents

Advertisement

Series 3700 System Switch/Multimeter Reference Manual
~= ........................................................................................................ (not equal)
== ............................................................................................................. (equal)
Logical operators:
and
or
not

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:
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.
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)
end
sum, diff, ratio = sum_diff_ratio(2,3)
print(sum)
print(diff)
print(ratio)
Output of code above:
7
12
Document Number: 3700S-901-01 Rev. A / August 2007
psum = parameter1 + parameter2
pdif = parameter1 – parameter2
prat = parameter1 / parameter2
return psum, pdif, prat
Section 2: TSP Programming Fundamentals
2-25

Advertisement

Table of Contents
loading

Table of Contents