EasyManuals Logo
Home>Keithley>Measuring Instruments>2611B

Keithley 2611B Reference Manual

Keithley 2611B
864 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 #302 background imageLoading...
Page #302 background image
Series 2600B
System SourceMeter® Instrument Reference Manual Section 6:
Instrument programming
2600BS-901-01 Rev. B / May 2013 6-25
Example: Break with infinite loop
a, b = 0, 1
while true do
print(a, b)
a, b = b, a + b
if a > 500 then
break
end
end
This example uses a break statement
that causes the while loop to exit if the
value of a becomes greater than 500.
Output:
0 1
1 1
1 2
2 3
3 5
5 8
8 13
13 21
21 34
34 55
55 89
89 144
144 233
233 377
377 610
Tables and arrays
Lua makes extensive use of the data type table, which is a flexible array-like data type. Table indices
start with 1. Tables can be indexed not only with numbers, but with any value except nil. Tables can
be heterogeneous, which means that they can contain values of all types except nil.
Tables are the sole data structuring mechanism in Lua. They may be used to represent ordinary
arrays, symbol tables, sets, records, graphs, trees, and so on. To represent records, Lua uses the
field name as an index. The language supports this representation by providing a.name as an easier
way to express a["name"].
The output you get from this example may vary depending on the data format settings of the
instrument.
Example: Loop array
atable = {1, 2, 3, 4}
i = 1
while atable[i] do
print(atable[i])
i = i + 1
end
Defines a table with four numeric
elements.
Loops through the array and prints
each element.
The Boolean value of
atable[index] evaluates to true if
there is an element at that index. If
there is no element at that index, nil
is returned (nil is considered to be
false).
Output:
1
2
3
4

Table of Contents

Other manuals for Keithley 2611B

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Keithley 2611B and is the answer not in the manual?

Keithley 2611B Specifications

General IconGeneral
BrandKeithley
Model2611B
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals