![background image](http://html1.mh-extra.com/html/omron/cs1-h-series/cs1-h-series_operation-manual_742526161.webp)
146
Structured Text (ST Language) Specifications
Appendix B
Example:
IF
<
condition_1
>
THEN
IF
<
condition_2
>
THEN
<
expression_1
>
;
ELSE
<
expression_2
>
:
END_IF;
END_IF;
The processing flow diagram is as follows:
ELSE corresponds to THEN immediately before it, as shown in the above diagram.
• Multiple statements can be executed within
expression_1
and
expression_2.
Be sure to use a semicolon (;)
delimiter between multiple statements in an
expression
.
• The ELSE statement can be omitted. When ELSE is omitted, no operation is executed if the result of the
condition
equation is false.
Processing Flow Diagram
Examples
Example 1: If variable A>0 is true, variable X will be substituted with numerical value 10. If A>0 is false, variable
X will be substituted with numerical value 0.
IF A>0 THEN
X:=10;
ELSE
X:=0;
END_IF;
Example 2: If variable A>0 and variable B>1 are both true, variable X will be substituted with numerical value
10, and variable Y will be substituted with numerical value 20. If variable A>0 and variable B>1 are both false,
variable X and variable Y will both be substituted with numerical value 0.
Condition 1
Condition 2
False
True
False
True
Expression 1
Expression 1
Condition
False
True
Expression
Содержание CS1-H Series
Страница 3: ...iv...
Страница 5: ...vi...
Страница 7: ...viii TABLE OF CONTENTS...
Страница 15: ...xvi Application Precautions 4...
Страница 151: ...136 Procedures Section 3 2...
Страница 153: ...138 Data Types Appendix A...
Страница 177: ...162 External Variables Appendix C...
Страница 181: ...166 Revision History...