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

Function blocks/ structured text
Table of Contents

Advertisement

Statement Descriptions

5-5

Statement Descriptions

5-5-1

Assignment

5-5-2

Control Statements

IF Statement (Single
Condition)
Note
148
■ 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.
■ 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
ELSE can be omitted.
■ Statement Syntax
IF <condition> THEN
<expression_1>;
ELSE
<expression_2>;
END_IF;
Section 5-5

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac ws02-cxpc1-v8Sysmac cx-programmer 8.1

Table of Contents