About SRL operators

SRL operators are used for tests of equality, Boolean comparisons, and mathematical operations.

For example, in the expression 1 + 1, the + symbol is referred to as an operator.

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.

For example, the + operator adds two numbers together to produce a new number.

The + operator is a special operator that can play multiple roles. The result of the operator depends upon the types of the operands.

For example, when the + operator is used with string values, the operator performs concatenation to produce a new string that consists of the characters of the second string appended to the end of the first string.

The + operator performs addition when used with numbers. The + operator performs concatenation when used with one string and one number.

For example, "Josh"+1 produces "Josh1".

Some operators, such as the NOT operator, only operate on a single operand.

For example, the NOT operator evaluates truthful values as false, and false values as true (in other words, "NOT true" evaluates to "false").

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
"hello" + "world" evaluates to "helloworld"

-

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
5 MOD 2 evaluates to 1 (because 5 / 2 is 2 remainder 1)
MOD simply yields the integer value of the remainder

*

Multiplication

2 * 3 evaluates to 6

AND

Boolean AND. If both operands are true, then evaluates to true.

true and true evaluates to true
true and false evaluates to false
false and false evaluates to false

OR

Boolean OR. If either operand is true, then evaluates to true.

true or true evaluates to true
true or false evaluates to true
false or false evaluates to false

NOT

Boolean NOT. Evaluates to the inverse of the value following the operator.

NOT true evaluates to false
NOT false evaluates to true

XOR

Boolean exclusive OR. Only evaluates to true if one value, but not the other, is true.

true XOR true evaluates to false
true XOR false evaluates to true
false XOR false evaluates to false

>

Greater than. Evaluates to true if the first number is greater than the second.

1 > 2 evaluates to false
2 > 1 evaluates to true

>=

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
2 >= 2 evaluates to true

<

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
1=2 evaluates to false
"A"="A" evaluates to true

!=

Inequality test. Evaluates to true if the first value is not equal to the second value.

1!=2 evaluates to true
1!=1 evaluates to false