User guide

8
E SR SCRIPT RM
4-1 Conditional branching of
process
To branch processes, use if sentences.
if sentence
Format
z For 1 branch
z For 2 branches (using else)
z For 3 branches (using elseif)
Reference
The "elsif condition then process" sentence can be written multiple
times.
if condition 1 then If "condition 1" is fulfilled, "process 1" is executed.
process 1 If "condition 1" is not fulfilled, no process is executed.
end
if condition 1 then
If "condition 1" is fulfilled, "process 1" is executed.
process 1
else
If "condition 1" is not fulfilled, "process 2" is executed.
process 2
end
if condition 1 then
If "condition 1" is fulfilled, "process 1" is executed.
process 1
elseif condition 2 then
If "condition 1" is not fulfilled but "condition 2" is fulfilled,
"process 2" is executed.
process 2
else
If both "condition 1" and "condition 2" are not fulfilled, "process
3" is executed.
process 3
end
condition 1
process 1 process 2 process 3
condition 2
Yes
No
Yes
No
Conditional expression
For "condition" of if sentences, write conditional expressions using comparative
operators as below.
For details of comparative operators, refer to "3-2 Comparison" (Page 6).
Reference
Up to 20 nests can be made for the conditional branching.
Comparison type Conditional expression Description
Character string
comparison
if (str == "A") then If str is equal to "A"
if (str ~= "A") then If str is not equal to "A"
Numerical value
comparison
if (i < 10) then If i is less than 10
if (i < =10) then If i is 10 or less
if (i ==10) then If i is equal to 10
if (i > =10) then If i is 10 or more
if (i > 10) then If i is more than 10
if (i ~=10) then If i is a number other than 10
Character string
comparison
if ( bool == true) then if bool is true
if ( bool ~= true) then if bool is not true
Example 1
if type<10 then
If type is less than 10, assign 1 to termID.
termID=1
end
Example 2
if type<10 then
If type is less than 10, assign 10 to termID.
termID=10
elseif type<20 then
If type is 10 or more and less than 20, assign 20 to termID.
termID=20
else
If type is 20 or more, assign 30 to termID.
termID=30
end