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;
Содержание CX-PROGRAMMER V8.1
Страница 3: ...iv...
Страница 5: ...vi...
Страница 7: ......
Страница 15: ...xvi...
Страница 19: ...xx...
Страница 25: ...xxvi Application Precautions 4...
Страница 26: ...Part 1 Function Blocks...
Страница 27: ......
Страница 153: ...128 Procedures Section 3 2...
Страница 154: ...Part 2 Structured Text ST...
Страница 155: ......
Страница 159: ...134 CX Programmer Specifications Section 4 2...
Страница 205: ...180 Procedures Section 6 1...
Страница 207: ...182 System defined external variables supported in function blocks Appendix A...
Страница 229: ...204 Revision History...
Страница 230: ......