Branching - Keithley 2601 Reference Manual

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

Advertisement

Section 2: TSP Programming

Branching

TSL uses the "if" keyword to do conditional branching.
--
-------------------------------- IF blocks ------------------------
--
if 0 then
print("Zero is true!")
else
print("Zero is false.
end
x = 1
y = 2
if (x and y) then
print("' if ' expression 2 was not false.")
end
if (x or y) then
print("' if ' expression 3 was not false.")
end
if (not x) then
print("' if ' expression 4 was not false.")
else
print("' if ' expression 4 was false.")
end
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
Output of code above:
Zero is true!
' if ' expression 2 was not false.
' if ' expression 3 was not false.
2-50
Series 2600 System SourceMeter® Instruments Reference Manual
-- Zero IS true! This is a contrast to C where 0 evaluates
false. In TSL, "nil" is false and everything else is true.
)
"
-- if expression 1.
-- if expression 2.
-- if expression 3.
-- if expression 4.
-- if expression 5.
Return to
Section Topics
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