![Keithley SourceMeter 2600B Series Скачать руководство пользователя страница 296](http://html2.mh-extra.com/html/keithley/sourcemeter-2600b-series/sourcemeter-2600b-series_reference-manual_4085220296.webp)
Series 2600B System SourceMeter® Instrument Reference Manual
Section 6: Instrument programming
2600BS-901-01 Rev. C / August 2016
6-19
The syntax of a conditional block is as follows:
if
expression
then
block
elseif
expression
then
block
else
block
end
Where:
•
expression
is Lua code that evaluates to either
true
or
false
•
block
consists of one or more Lua statements
Example: If
if 0 then
print("Zero is true!")
else
print("Zero is false.")
end
Output:
Zero is true!
Example: Comparison
x = 1
y = 2
if x and y then
print("Both x and y are true")
end
Output:
Both x and y are true
Example: If and else
x = 2
if not x then
print("This is from the if block")
else
print("This is from the else block")
end
Output:
This is from the else
block