ST Expressions

An expression is a construct that returns a value following its evaluation.

Expressions are composed of operators and operands. In Extended Structured Text (ExST) you can also use assignments as expressions. An operand can be a constant, a variable, a function call or a further expression.

Examples

2014 (* Constant *)
ivar (* Variable *)
fct(a,b) (* Function call *)
(x*y)/z (* Expression *)
real_var2 := int.var; (* in ExST: Assignment *) *)

See also

Evaluation of expressions

The evaluation of an expression takes place by processing the operators according to certain rules of binding. CODESYS processes the operator with the strongest binding first. Operators with the same binding strength are processed from left to right.

Operation Symbol Binding strength
Parenthesize (Expression) Strongest binding
Function Call

Function name (parameter list)

all operators with syntax: <operator> ()

 
Exponentiate EXPT  

Negate

Complementation

-

NOT

 

Multiplication

Division

Modulo

*

/

MOD

 

Addition

Subtraction

+

-

 
Comparison <,>,<=,>=  

Equality

Inequality

=

<>

 
Bool AND

AND

AND_THEN

 
Bool XOR XOR  
Bool OR

OR

OR_ELSE

Weakest binding

See also