ExST – Assignment as Expression

In ExST, as an extension to the IEC 61131-3 standard, CODESYS permits the use of assignments as expressions.

Examples

int_var1 := int_var2 := int_var3 + 9; (* int_var1 and int_var2 receive the value of int_var3 + 9 *)
real_var1 := real_var2 := int_var; (* real_var1 and real_var2 receive the value of int_var *)
int_var := real_var1 := int_var; (* incorrect assignment, the data types do not correspond! *)

IF b := (i = 1) THEN

i := i + 1;

END_IF

 

See also