## How To: Use basic scripting operators

**Overview
**

In order to script correctly, calculate and use functions with our complex scripting engine – basic knowledge of programming operators is needed.

The following ‘How To’ will summarize all the common used operators syntax and their truth tables.

**Logic Operators:
**

A |
B |
A && B |

FALSE |
FALSE |
FALSE |

FALSE |
TRUE |
FALSE |

TRUE |
FALSE |
FALSE |

TRUE |
TRUE |
TRUE |

‘OR’ Operator:

The ‘OR’ operator is represented as ‘||’ in code and its truth table is the following:

A |
B |
A || B |

FALSE |
FALSE |
FALSE |

FALSE |
TRUE |
TRUE |

TRUE |
FALSE |
TRUE |

TRUE |
TRUE |
TRUE |

‘NOT’ Operator:

The ‘NOT’ operator is represented as ‘ ! ‘ in code and its truth table is the following:

A |
!A |

FALSE |
TRUE |

TRUE |
FALSE |

XOR’ Operator:

The ‘XOR’ operator is represented as ‘ ^ ‘ in code and its truth table is the following:

A |
B |
A ^ B |

FALSE |
FALSE |
FALSE |

FALSE |
TRUE |
TRUE |

TRUE |
FALSE |
TRUE |

TRUE |
TRUE |
FALSE |

Mathematical Operators:

‘GREATER THAN’ Operator:

The ‘GREATER THAN’ operator is represented as ‘ > ‘ in code. (Return’s TRUE or FALSE)

‘GREATER THAN OR EQUALS TO’ Operator:

The ‘GREATER THAN OR EQUALS TO’ operator is represented as ‘ >=’ in code. (Return’s TRUE or FALSE)

‘SMALLER THAN’ Operator:

The ‘GREATER THAN’ operator is represented as ‘ < ‘ in code. (Return’s TRUE or FALSE)

‘SMALLER THAN OR EQUALS TO’ Operator:

The ‘GREATER THAN’ operator is represented as ‘ <= ‘ in code. (Return’s TRUE or FALSE)

The ‘EQUALS TO operator is represented as ‘ == ‘ in code. (Return’s TRUE or FALSE)

* Please note that using ‘=’ operator will assign the right value to the left and NOT check if they are equal.

‘NOT EQUALS TO’ Operator:

The ‘NOT EQUALS TO operator is represented as ‘ != ‘ in code. (Return’s TRUE or FALSE)

‘+’ is used for adding.

‘-‘ is used for subtracting.

‘/’ is used for dividing. (Remnant is dismissed).

‘%’ is used for getting the remnant from dividing by ‘x’.

‘*’ is used for multiplying.

‘+=’ is used to do the following: ‘x += 2’ is a short way to write: ‘x = x + 2’. (the same for the rest of the operators).

This is a summary of most of the commonly used operators.

**Visit us at: http://www.dooblo.net**