EasyManua.ls Logo

Omron CX-PROGRAMMER V8.1 - Statement Descriptions; Assignment; Control Statements

Omron CX-PROGRAMMER V8.1
231 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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;

Table of Contents

Related product manuals