Section 2
:
TSP Programming Fundamentals
Series 3700 System Switch/Multimeter Reference Manual
2-30
Document Number: 3700S-901-01 Rev. A / August 2007
x = 1
y = 2
if (x and y) then
print("' if ' expression 2 was not
false.")
end
This is
if expression 2
.
if (x or y) then
print("' if ' expression 3 was not false.")
end
This is
if expression 3
.
if (not x) then
print("' if ' expression 4 was not
false.")
else
print("' if ' expression 4 was
false.")
end
This is
if expression 4
.
if x == 10 then
print("x = 10")
elseif y > 2 then
print("y > 2")
else
print("x is not equal to 10,
and y is not less than 2.")
end
This is
if expression 5
.
Output of code above:
Zero is true!
' if ' expression 2 was not false.
' if ' expression 3 was not false.
' if ' expression 4 was false.
x is not equal to 10, and y is not less than 2.
Loop control
TSL has familiar constructs for doing things repetitively and/or until an expression evaluates to
false.
The following code contains an example iteration:
list = {"One", "Two", "Three", "Four", "Five", "Six"}