![Omron SYSMAC CX-Programmer 9 Operation Manual Download Page 174](http://html1.mh-extra.com/html/omron/sysmac-cx-programmer-9/sysmac-cx-programmer-9_operation-manual_744241174.webp)
148
Statement Descriptions
Section 5-5
5-5
Statement Descriptions
5-5-1
Assignment
■
Summary
The left side of the statement (variable) is substituted with the right side of the
statement (equation, variable, or constant).
■
Reserved Words
:=
Combination of colon (:) and equals sign (=).
■
Statement Syntax
Variable:
=
Equation, variable, or constant;
■
Usage
Use assignment statements for inputting values in variables. This is a basic
statement for use before or within control statements. This statement can be
used for setting initial values, storing calculation results, and incrementing or
decrementing variables.
■
Description
Substitutes (stores) an
equation
,
variable
, or
constant
for the
variable
.
Examples
Example 1: Substitute variable A with the result of the equation X+1.
A:=X+1;
Example 2: Substitute variable A with the value of variable B.
A:=B;
Example 3: Substitute variable A with the constant 10.
A:=10;
■
Precautions
The data type of the equation, variable, or constant to be assigned must be
the same as the data type of the variable to be substituted. Otherwise, a syn-
tax error will occur.
5-5-2
Control Statements
IF Statement (Single
Condition)
■
Summary
This statement is used to execute an expression when a specified condition is
met. If the condition is not met, a different expression is executed.
■
Reserved Words
IF, THEN, (ELSE), END_IF
Note
ELSE can be omitted.
■
Statement Syntax
IF
<
condition
>
THEN
<
expression_1
>
;
ELSE
<
expression_2
>
;
END_IF;
Summary of Contents for SYSMAC CX-Programmer 9
Page 2: ......
Page 4: ...iv ...
Page 6: ...vi ...
Page 8: ......
Page 16: ...xvi ...
Page 20: ...xx ...
Page 26: ...xxvi Application Precautions 4 ...
Page 27: ...Part 1 Function Blocks ...
Page 28: ......
Page 154: ...128 Procedures Section 3 2 ...
Page 155: ...Part 2 Structured Text ST ...
Page 156: ......
Page 160: ...134 CX Programmer Specifications Section 4 2 ...
Page 206: ...180 Procedures Section 6 1 ...
Page 208: ...182 System defined external variables supported in function blocks Appendix A ...
Page 230: ...204 Revision History ...
Page 231: ......