Go to documentation repository
The table below lists and describes comparison, arithmetic and conditional operators.
Operator | General description, example of use |
Comparison operators | |
> | Comparison operator—greater. See example in Description of operators |
< | Comparison operator—less. See example in Description of operators |
Arithmetic operators | |
+ | Addition operator. Example of use: OnEvent ("MACRO","1","RUN") { x=5; y=10; i=x+y; // add strings, i.e. 5+10=510 e=str(x+y); // add integers 5+10=15 } |
- | Subtraction operator. Example of use: OnEvent ("MACRO","1","RUN") { x=5; y=10; i=x-y; // subtract integers 5-10=-5 e=str(x-y); // subtract integers 5-10=-5 } |
* | Multiplication operator. Example of use: OnEvent ("MACRO","1","RUN") { x=5; y=10; i=x*y; // multiply integers 5*10=50 e=str(x*y); // multiply integers 5*10=50 } |
/ | Division operator. Example of use: OnEvent ("MACRO","1","RUN") { x=5; y=10; i=x/y; // divide integers 5/10=0.5 e=str(x/y); // divide integers 5/10=0.5 } |
% | Remainder after integer division. Example of use. OnEvent ("MACRO","1","RUN") { a=1120.0; b=100; e=a%b; // remainder after integer division, i.e 1100 is divided by 100 and 20 is remainder. // if there is division without remainder, then result is 0 } |
( ) | Group of arithmetic operators. Example of use. OnEvent ("MACRO","1","RUN") { x=100/((5*8)/1.028); } |
Logical operators | |
&& | Logical AND operator. Example of use: OnEvent ("MACRO","1","RUN") { a=1; b=2; z=3; if((a<b)&&(b<z)) { y=1; //if false, then else } else { x=0; } } |
! | Logical inversion operator. Example of use: OnEvent ("CAM",N,"MD_START") { if(!(strequal(N,"1",))) { DoReact("GRELE","1",""ON) } else { DoReact("GRELE","2",""ON) } } |