When you combine several operators in a single expression, the operations are performed in the following order.
| Order | Operator | Description | 
|---|---|---|
| 1 | ! | Boolean NOT | 
| 2 | - | Negation (as in -1) | 
| 3 | *, /, ^, and % | Multiplication, division, exponentiation, and modulus | 
| 4 | + and - | Addition and subtraction | 
| 5 | <, <=, >, and >= | Comparison | 
| 6 | == and != | Equivalence | 
| 7 | && | Boolean AND | 
| 8 | || | Boolean OR | 
Use the following arithmetic operators to perform basic mathematical operations.
| Arithmetic Operator | Description | 
|---|---|
| + | Addition | 
| - | Subtraction | 
| * | Multiplication | 
| / | Division | 
| % | Integer Modulo | 
| ^ | Exponentiation | 
Use the following operators to compare two values with each other. When two values are compared using these operators, the result is 1 if the comparison is true and 0 if the comparison is false.
| Comparison Operator | Description | 
|---|---|
| == | Equal to | 
| != | Not equal to | 
| < | Less than | 
| <= | Less than or equal to | 
| > | Greater than | 
| >= | Greater than or equal to | 
| && | Boolean AND | 
| || | Boolean OR | 
| ! | Boolean NOT | 
 Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License