Operators
EV Script has the following types of operators:
Concatenate with the + Operator
used to add string variables or text together (concatenation).
<?ev
var firstName = 'Bobby';
var lastName = 'Bobson';
var fullName = firstName + ' ' + lastName;
?>
Arithmetic Operators
used to perform mathematical operations between variables and/or values.
+
|
Addition or concatenation |
-
|
Subtraction |
*
|
Multiplication |
/
|
Division |
%
|
Modulous (division remainder) |
++A
|
Increment before assignment |
A++
|
Increment after assignment |
--A
|
Decrement before assignment |
A--
|
Decrement after assignment |
Assignment Operators
used to assign values to variables.
=
|
e.g. A=B Assign B to A |
+=
|
e.g. A+=B Shorthand for A = A+B |
-=
|
e.g. A-=B Shorthand for A = A-B |
*=
|
e.g. A*=B Shorthand for A = A*B |
/=
|
e.g. A/=B Shorthand for A = A/B |
%=
|
e.g. A%=B Shorthand for A = A%B |
Comparison Operators
used in logical statements to identify the relationship between variables or values.
==
|
is equal to |
!=
|
is not equal to |
>
|
is the left value greater than the right value |
<
|
is the left value less than the right value |
>=
|
is the left value greater than or equal to the right value |
<=
|
is the left value less than or equal to the right value |
Conditional Operator
shorthand conditional statements used to return a value based on a condition.
<?ev
var c = (a > b) ? a : b;
?>
Logical Operators
used to determine the logic between variables, values and conditions.
!
|
Not the condition, variable or value that follows.
|
||
|
Either A or B are considered to be true |
&&
|
Both A and B are considered to be true |