Section 6: Instrument programming
Models 707B and 708B Switching Matrix Reference Manual
6-18
707B-901-01 Rev. A / August 2010
Example: Boolean
Code Output
y = false
print(y, type(y))
false boolean
Example: String and number
Code Output
x = "123"
print(x, type(x))
x = x + 7
print(x, type(x))
123 string
Adding a number to x forces its type to number
1.302 number
Example: Function
Code Output
function add_two(parameter1, parameter2)
return para parameter2
end
print(add_two(3, 4), type(add_two))
7.000 function
Example: Table
Code Notes
and
Output
atable = {1, 2, 3, 4}
print(atable, type(atable))
print(atable[1])
print(atable[4])
Defines a table with four numeric elements.
Note that the "table" value (shown here as
a096cd30
) will vary.
table: a096cd30 table
1.000
4.000
To delete a global variable, assign
nil
to the global variable. This removes the global variable from
the runtime environment.