3 - 26 3 - 26
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.7 Letting BASIC Make Decisions
In BASIC, a program can be branched into different instructions based on whether or
not a specified condition is met.
3.7.1 Condition specification
The following symbols are used to specify conditions.
Symbol
Meaning
Example
=
Equal to
A=B
• • • • • • The condition is met when A and B are equal.
<
Less than
A<B
• • • • • • The condition is met when A is less than B.
>
Greater than
A>B
• • • • • • The condition is met when A is greater than B.
<=
Equal to or less than
(Including and up to)
A<=B
• • • • • • The condition is met when A is less than or equal
to B.
=>
Equal to or greater than
(Including and more than)
A>=B
• • • • • • The condition is met when A is greater than or
equal to B.
<>
Not equal to
A<>B
• • • • • • The condition is met when A is not equal to B.
More conditions can be created by combining these symbols with the logical operators
'AND' and 'OR.' When a condition is combined with another condition, they are referred
to as "logical expressions."
• When using 'AND'
• • • Conditions are connected using the logical
operator 'AND.' There is no restriction on the
number of conditions that can be connected using
the logical operator.
Example A=B AND C=D
• • • The condition is met when A and B are equal and
C and D are equal.
This is the same as the
@ symbol used for sets
in mathematics.
C=D
A=B
Area where the condition
is met when AND is used
• When using 'OR'
• • • Conditions are connected using the logical
operator 'OR.' There is no restriction on the
number of conditions that can be connected using
the logical operator.
Example A=B OR C=D
• • • The condition is met when A and B are equal or C
and D are equal.
This is the same as the @ symbol
used for sets in mathematics.
A=B
C=D
Area where the condition is met when OR is used