Keithley 708B Reference Manual page 219

Switching matrix
Hide thumbs Also See for 708B:
Table of Contents

Advertisement

Section 6: Instrument programming
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 really
necessary to return or break in the middle of a block, then an explicit inner block can be used.
Example: Break with while statement
Code
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 i == 0 then
print("Break value not found")
end
Example: Break with while statement enclosed by comment delimiters
Code
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
6-28
Models 707B and 708B Switching Matrix Reference Manual
Notes
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 i = 3.0000000e+00
Notes
This example defines a break value
(breakValue), but the break value line is
preceded by comment delimiters so that the
break value is not assigned, and the code
reaches the value 0 to exit the while loop.
Output:
Break value not found
707B-901-01 Rev. A / August 2010

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

707b

Table of Contents