
Writing Scripts with Lingo
409
Note:
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.
When dividing one integer by another doesn’t result in a whole number, Lingo rounds the result
down to the nearest integer. For example, the result of
4/3
is
1
.
To force Lingo to calculate a value without rounding the result, use
float()
on one or more
values in an expression. For example, the result of
4/float(3)
is 1.333.
Comparison operators
Comparison operators compare two values and determine whether the comparison is true or false.
These are the comparison operators available in Lingo:
Logical operators
Logical operators test whether two logical expressions are true or false. These are the logical
operators available in Lingo:
The
not
operator is useful for toggling a
TRUE
or
FALSE
value to its opposite. For example,
the following statement turns on the sound if it’s currently off and turns off the sound if it’s
currently on:
set the soundEnabled = not (the soundEnabled)
+
Performs addition.
3
-
When placed between two numbers, performs subtraction.
3
Operator
Meaning
Precedence
<
Is less than
1
<=
Is less than or equal to
1
<>
Is not equal to
1
>
Is greater than
1
>=
Is greater than or equal to
1
=
Equals
1
Operator
Effect
Precedence
and
Determines whether both expressions are true.
4
or
Determines whether either or both expressions are true.
4
not
Negates an expression.
5
Operator
Effect
Precedence
Summary of Contents for Director MX
Page 1: ...Using Director MX Macromedia Director MX ...
Page 12: ...Contents 12 ...
Page 156: ...Chapter 4 156 ...
Page 202: ...Chapter 6 202 ...
Page 244: ...Chapter 7 244 ...
Page 292: ...Chapter 10 292 ...
Page 330: ...Chapter 12 330 ...
Page 356: ...Chapter 13 356 ...
Page 372: ...Chapter 14 372 ...
Page 442: ...Chapter 16 442 ...
Page 472: ...Chapter 18 472 ...
Page 520: ...Chapter 19 520 ...
Page 536: ...Chapter 20 536 ...
Page 562: ...Chapter 23 562 ...
Page 566: ...Chapter 24 566 ...
Page 602: ...Chapter 27 602 ...