Operator | expr1 operater expr2 returns -1 if and only if: |
> | expr1 is greater than expr2 |
>=, => | expr1 is greater than or equal to expr2 |
< | expr1 is less than expr2 |
<=, =< | expr1 is less than or equal to expr2 |
>> (strings only) | expr1 is greater than expr2 without regard to letter case |
<< (strings only) | expr1 is less than expr2 without regard to letter case |
Operator | Operator expr returns: |
+ | expr |
- | the negative (additive inverse) of expr |
Not | the binary 1's complement of expr. See Not in the main part of the manual. |
+ | Addition. |
- | Subtraction. |
* | Multiplication. |
/ | Division. If both operands are integer expressions, this operator does integer division. If either operand is a real number, the operator does floating point division. |
\ | Floating Point Division. The operator always does floating point division. Integer operands are converted to floating point before the division. |
\\ | Identical to / |
+= | Add the expression from the right of the equal sign to the variable on the left. Example: (a += b) is the same as coding (a = a + b) |
-= | Subtract the expression from the right of the equal sign from the variable on the left. Example: (a -= b) is the same as coding (a = a - b) |
*= | Multiply the left expression by the right expression and store the result in the left expression. Example: (a *= b) is the same as coding (a = a * b) |
/= | Divide the left expression by the right expression and store the result in the left expression. Example: (a /= b) is the same as coding (a = a / b) |
= | Assignment. (Also works for comparison, however for clarity == is preferred when comparing values.) Example: x = 5 |
== | Comparison. Example: if ( x == 5 ) then y = 2 * x |
++ | Increment a variable. Example: i++ |
-- | Decrement a variable. Example: i-- |
^ | Exponentiation (raising to a power). Example: 100^2 == 10000. |
<< | The first operand is shifted left by the number of bit positions specified by the second operand. Both operands must be integral values. A left shift by n is equivalent to multiplying by 2^n. The result is undefined if n is negative or greater than the width in bits of the first operand. |
>> | The first operand is shifted right by the number of bit positions specified by the second operand. Both operands must be integral values. A right shift by n is equivalent to dividing by 2^n with rounding towards minus infinity. The result is undefined if n is negative or greater than the width in bits of the first operand. |
and; & | Bitwise And operator. See the description in the main part of the manual. |
or; | | Bitwise Or operator. See the description in the main part of the manual. |
nand; ^& | Bitwise Not And (Nand) operator. See the description in the main part of the manual. |
nor; ^| | Bitwise Not Or operator. See the description in the main part of the manual. |
xor; ^^ | Bitwise Xor operator. See the description in the main part of the manual. |
&& | Logical And operator. See the description in the main part of the manual. |
|| | Logical Or operator. See the description in the main part of the manual. |
mod | Modulus operator. See the description in the main part of the manual. |
The following table lists the operators in order of their precedence, from highest to lowest. When an expression contains several operators at the same level of precedence (and within the same depth of parentheses), their operations are always performed from left to right.
1 | unary "+"; unary "-"; not |
2 | ^ |
3 | *; /; \; \\; mod |
4 | + (addition); - (substraction) |
5 | <; <=; >; >=; =; ==; <>; != << (strings); >> (strings) |
6 | << (shift left); >> (shift right) |
7 | and; or; xor; nand; nor; &; |; ^&; ^|; ^^; &&; || |