EasyManua.ls Logo

Keithley DMM7510

Keithley DMM7510
1036 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Section
7: Introduction to TSP commands Model DMM7510 7½ Digit Graphical Sampling Multimeter
Reference Manual
7-24 DMM7510-901-01 Rev. B / May 2015
Example: Generic for
days = {"Sunday",
"Monday", "Tuesday",
"Wednesday", "Thursday",
"Friday", "Saturday"}
for i, v in ipairs(days) do
print(days[i], i, v)
end
The generic for statement works by using functions called iterators. On each iteration, the
iterator function is called to produce a new value, stopping when this new value is nil.
Output:
Sunday 1 Sunday
Monday 2 Monday
Tuesday 3 Tuesday
Wednesday 4 Wednesday
Thursday 5 Thursday
Friday 6 Friday
Saturday 7 Saturday
Break
The break statement can be used to terminate the execution of a while, repeat, or for loop,
skipping to the next statement after the loop. A break ends the innermost enclosing loop.
Return and break statements can only be written as the last statement of a block. If it is necessary to
return or break in the middle of a block, an explicit inner block can be used.
The output you get from these examples may vary depending on the data format settings of the
instrument.
Example: Break with while statement
local numTable = {5, 4, 3, 2, 1}
local k = table.getn(numTable)
local breakValue = 3
while k > 0 do
if numTable[k] == breakValue then
print("Going to break and k = ", k)
break
end
k = k - 1
end
if k == 0 then
print("Break value not found")
end
This example defines a break value
(breakValue) so that the break statement is
used to exit the while
loop before the value of
k reaches 0.
Output:
Going to break and k = 3

Table of Contents

Other manuals for Keithley DMM7510

Related product manuals