Script Operators

 

The script is Use the following operators:

 

Arithmetic Operators

+  Binomial addition operator         a = 1 ; b = 1 ; c = a + b ;         //The result is c = 2.
-   Binomial subtraction operator  a = 4 ; b = 2 ; c = a – b ;         //The result is c = 2.
*   Multiplication operator               a = 3 ; b = 7 ; c = a * b ;          //The result is c = 21.
/   Division operator                         a = 21 ; b = 3 ; c = a / b ;          //The result is c = 7.
% Remainder operator                   a = 11 ; b = 3 ; c = a % b ;                //The result is c = 2.
&  AND operator                            a = 1 ; char b = 14 ; c = a & b ;        //This is the bitwise operator, so (char 1 byte) a = 00000001, b = 00001110, and the result of a & b = 00000001 & 00001110 is c = 00000000.
|   OR operator                               a = 1 ; char b = 14 ; c = a | b ;          //This is the bitwise operator, so (char 1 byte) a = 00000001, b = 00001110, a & b = 00000001 | The result of 00001110 is c = 00001111.
^  XOR operator                            a = 1 ; char b = 14 ; c = a ^ b ;    //This is the bitwise operator, so (char 1 byte) a = 00000001, b = 00001110, and the result of a & b = 00000001^00001110 is c = 00001111.

 

Substitution Operators

=     Substitution, assignment operators

 

Comparison Operators

==  Equals
>    big
>=  greater than or equal to
<    small
<=  less than or equal to
!=   is not equal to

 

Logical Operators: This is mainly used in conditional statements.

&&  Logical Conjunction Operator. (AND)     if ( $DI_0001 == ON  &&  $DI_0002 == ON )  //Conditions when the digital input signal DI_0001 and DI_0002 are ON at the same time

||      Logical Disjunction Operator (OR)          if ( $DI_0001 == ON  ||  $DI_0002 == ON )     //Conditions when either the digital input signal DI_0001 or DI_0002 is ON.

 

Related Helps)

Editing a Script

Types of scripts

How to use the Script Editor

Script Main Help