Series 2600 System SourceMeters Reference Manual TSP Programming Fundamentals 2-59
Return to
2600S-901-01 Rev. A / May 2006
Branching
TSL uses the “if” keyword to do conditional branching.
--
-------------------------------- IF blocks ------------------------
--
if 0 then
-- Zero IS true! This is a contrast to C where
print("Zero is true!")
0 evaluates false. In TSL, “nil” is false
else
and everything else is true.
print("Zero is false.
"
)
end
-- if expression 1.
x = 1
y = 2
if (x and y) then
print("' if ' expression 2 was not false.")
end
-- if expression 2.
if (x or y) then
print("' if ' expression 3 was not false.")
end
-- if expression 3.
if (not x) then
print("' if ' expression 4 was not false.")
else
print("' if ' expression 4 was false.")
end
-- 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
-- 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.
Содержание SourceMeter 2600 Series
Страница 507: ...AppendixA Specifications Appendix A topics Model 2600S Specifications page A 2 2600S 901 01 Rev A May 2006...
Страница 575: ...AppendixF DisplayCharacterCodes Appendix F topics Introduction page F 2...
Страница 592: ......
Страница 593: ......