Arithmetic operators
Arithmetic operators add, subtract, multiply, divide, and perform other arithmetic operations.
Parentheses and the minus sign are also arithmetic operators.
Operator
Effect
Groups operations to control precedence order.
( )
-
When placed before a number, reverses the sign of a number.
Performs multiplication.
*
(Lingo only) Performs modulo operation.
mod
Performs division.
/
%
(JavaScript syntax only) Returns the integer remainder of dividing
two operands.
(JavaScript syntax only) Adds one to its operand. If used as a prefix
++
operator (
as a postfix operator (
adding one.
(JavaScript syntax only) Subtracts one from its operand. The return
--
value is analogous to that of the increment operator.
+
When placed between two numbers, performs addition.
When placed between two numbers, performs subtraction.
-
Note: In Lingo, when only integers are used in an operation, the result is an integer. Using integers
and floating-point numbers in the same calculation results in a floating-point number. In JavaScript
syntax, all calculations essentially result in floating-point numbers.
When dividing one integer by another does not result in a whole number, Lingo rounds the result
down to the nearest integer. For example, the result of
floating-point value, 1.333, is returned.
To force Lingo to calculate a value without rounding the result, use
values in an expression. For example, the result of
Comparison operators
Comparison operators compare two values and determine whether the comparison is true or false.
Operator
Meaning
==
(JavaScript syntax only) Two operands are equal. If the operands are
not of the same data type, JavaScript syntax attempts to convert the
operands to an appropriate data type for the comparison.
===
(JavaScript syntax only) Two operands are equal and of the same
data type
(JavaScript syntax only) Two operands are not equal. If the operands
!=
are not of the same data type, JavaScript syntax attempts to convert the
operands to an appropriate data type for the comparison.
26
Chapter 2: Director Scripting Essentials
), returns the value of its operand after adding one. If used
++x
), returns the value of its operand before
x++
is
. In JavaScript syntax, the actual
4/3
1
float()
is 1.333.
4/float(3)
Precedence
5
5
4
4
4
4
4
4
3
3
on one or more
Precedence
1
1
1
Need help?
Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?
Questions and answers