Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

 

Operator

General description, example use

Comparison operators

Comparison operator – greater.

See example in Description of operators section.

Comparison operator – greater.

See example in Description of operators section.

Arithmetic operators

+

Addition. Example use:

Code Block
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. Example use:

Code Block
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. Example use:

Code Block
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. Example use:

Code Block
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 use.

Code Block
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 use.

Code Block
OnEvent ("MACRO","1","RUN")

 

{

 


{
 x=100/((5*8)/1.028);

 


}

Logical operators

&&

Logical AND operator. Example use:

Code Block
OnEvent ("MACRO","1","RUN")

 

{

 


{
  a=1;

 


  b=2;

 


  z=3;

 


  if((a<b)&&(b<z)) 
  {
    y=1; //if false, then
else

 

}

 

else {
 else
  }
  else 
  {
    x=0;
}

 


  }
}

!

Logical inversion operator. Example use:

Code Block
OnEvent ("CAM",N,"MD_START")

 

{

 


{
  if(!(strequal(N,
”1”
"1",)))

 

            {

 

             DoReact(“GRELE”,”1”,””ON)

 

             }

 

else

 

            {

 

             DoReact(“GRELE”,”2”,””ON)

 

             }

 


      {
      DoReact("GRELE","1",""ON)
      }
else
      {
      DoReact("GRELE","2",""ON)
      }
}