2600AS-901-01 Rev. B / September 2008 Return to Section Topics 19-7
Series 2600A System SourceMeter® Instruments Reference Manual Section 19: Remote Commands
print(not nil)
print(not false)
print(not 0)
print(not not nil)
Output of code above:
true
true
false
false
Concatenation
TSL denotes the string concatenation operator by “..” (two dots). If any of its operands is a number,
TSL converts that number to a string:
print("Hello ".."World")
print(0 .. 1)
Output of code above:
Hello World
01
Branching
TSL uses the “if” keyword to do conditional branching.
--
-------------------------------- IF blocks ------------------------
--
-- Zero IS true! This is a contrast to C where 0 evaluates false. In TSL,
-- both "nil" and false are false and everything else is true.
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