EasyManuals Logo

Keithley 2657A User Manual

Keithley 2657A
805 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
Page #270 background imageLoading...
Page #270 background image
Model 2657A High Power System SourceMeter® Instrument Reference Manual Section 6: Instrument programming
2657A-901-01 Rev. B/December 2012 6-21
While loops
To use conditional expressions to determine whether to execute or end a loop, you use while loops.
These loops are similar to Conditional branching
(on page 6-19) statements.
while expression do
block
end
Where:
• expression is Lua code that evaluates to either true or false
• block consists of one or more Lua statements
Example: While
list = {
"One", "Two", "Three", "Four", "Five", "Six"}
print("Count list elements on numeric index:")
element = 1
while list[element] do
print(element, list[element])
element = element + 1
end
This loop exits when list[element]
= nil.
Output:
Count list elements on
numeric index:
1.00000e+00 One
2.00000e+00 Two
3.00000e+00 Three
4.00000e+00 Four
5.00000e+00 Five
6.00000e+00 Six
Repeat until loops
To repeat a command, you use the repeat ... until statement. The body of a repeat statement
always executes at least once. It stops repeating when the conditions of the until clause are met.
repeat
block
until expression
Where:
• block consists of one or more Lua statements
• expression is Lua code that evaluates to either true or false
Example: Repeat until
list = {
"One", "Two", "Three", "Four", "Five", "Six"}
print("Count elements in list using repeat:")
element = 1
repeat
print(element, list[element])
element = element + 1
until not list[element]
Output:
Count elements in list
using repeat:
1.00000e+00 One
2.00000e+00 Two
3.00000e+00 Three
4.00000e+00 Four
5.00000e+00 Five
6.00000e+00 Six

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Keithley 2657A and is the answer not in the manual?

Keithley 2657A Specifications

General IconGeneral
BrandKeithley
Model2657A
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals