About SRL operators
SRL operators are used for tests of equality, Boolean comparisons, and mathematical operations.
The values surrounding the operator here are referred to as operands. Operators are said to operate on operands. In general, operators require/take two values and, when evaluated, produce a new value.
The + operator is a special operator that can play multiple roles. The result of the operator depends upon the types of the operands.
The + operator performs addition when used with numbers. The + operator performs concatenation when used with one string and one number.
Some operators, such as the NOT operator, only operate on a single operand.
The SRL operators and their descriptions are shown in the table below.
Table of operators
Operator |
Description |
Example(s) |
+ |
Addition or concatenation. |
1 + 1 evaluates to 2 |
- |
Subtraction |
1 - 1 evaluates to 0 |
/ |
Division |
1 / 1 (the result is precise up to 16 significant digits; any number divided by zero evaluates to null) |
MOD |
Remainder of division. Returns the integer remainder as a result of dividing the first number by the second. |
2 MOD 2 evaluates to 0 |
* |
Multiplication |
2 * 3 evaluates to 6 |
AND |
Boolean AND. If both operands are true, then evaluates to true. |
true and true evaluates to true |
OR |
Boolean OR. If either operand is true, then evaluates to true. |
true or true evaluates to true |
NOT |
Boolean NOT. Evaluates to the inverse of the value following the operator. |
NOT true evaluates to false |
XOR |
Boolean exclusive OR. Only evaluates to true if one value, but not the other, is true. |
true XOR true evaluates to false |
> |
Greater than. Evaluates to true if the first number is greater than the second. |
1 > 2 evaluates to false |
>= |
Greater than or equal to. Evaluates to true if the first number is greater than or equal to the second. |
1 >= 2 evaluates to false |
< |
Less than. Evaluates to true if the first number is less than the second. |
1 < 2 evaluates to true |
⇐ |
Less than or equal to. Evaluates to true if the first number is less than or equal to the second. |
1 ⇐ 1 evaluates to true |
= |
Equality test. Evaluates to true if the first value is equal to the second value. |
1=1 evaluates to true |
!= |
Inequality test. Evaluates to true if the first value is not equal to the second value. |
1!=2 evaluates to true |