Series 2600B System SourceMeter® instrument Reference Manual Section 8: Instrument programming
2600BS-901-01 Rev. F/August 2021 8-23
if 0 then
print("Zero is true!")
else
print("Zero is false.")
end
x = 1
y = 2
if x and y then
print("Both x and y are true")
end
Output:
Both x and y are true
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
x = 1
y = 2
if x and y then
print("'if' expression 2 was not false.")
end
if x or y then
print("'if' expression 3 was not false.")
end
if not x then
print("'if' expression 4 was not false.")
else
print("'if' expression 4 was false.")
end
if x == 10 then
print("x = 10")
elseif y > 2 then
print("y > 2")
else
print("x is not equal to 10, and y is not greater than 2.")
end
Output:
'if' expression 2 was not false.
'if' expression 3 was not false.
'if' expression 4 was false.
x is not equal to 10, and y is not greater than 2.