Keithley SourceMeter 2600 Series Reference Manual page 112

Table of Contents

Advertisement

2-60 TSP Programming Fundamentals
Loop control
TSL has familiar constructs for doing things repetitively and/or until an expression
evaluates to false.
Something to iterate
list = {"One", "Two", "Three", "Four", "Five", "Six"}
--
-------------------------------- FOR loop ----------------------------
--
print(
for element = 1, 3 do
end
print("Counting from one to four,")
print("in steps of two:")
for element = 1, 4, 2 do
end
--
-------------------------------- WHILE loop --------------------------
--
print("Count elements in list")
print("on numeric index")
element = 1
while list[element] do
end
--
-------------------------------- REPEAT loop -------------------------
--
print("Count elements in list")
print("using repeat")
element = 1
repeat
until not list[element]
Output of code above:
Counting from one to three:
1 One
2 Two
3 Three
2600S-901-01 Rev. A / May 2006
"
Counting from one to three:
print(element, list[element])
print(element, list[element])
print(element, list[element])
element = element + 1
print(element, list[element])
element = element + 1
Return to
Series 2600 System SourceMeters Reference Manual
"
)
-- Will exit when list[element] = nil
Section 2 topics

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents