- (minus)
597
- (minus)
Usage
-- Lingo syntax
(Negation): -
expression
(Subtraction):
expression1
-
expression2
// JavaScript syntax
(Negation): -
expression
(Subtraction):
expression1
-
expression2
Description
Math operator; when used for negation, - (minus) reverses the sign of the value of
expression
;
when used for subtraction, - (minus) performs an arithmetic subtraction on two numerical
expressions, subtracting
expression2
from
expression1
.
When used for negation, - (minus) is an arithmetic operator with a precedence level of 5.
When used for subtraction, both expressions are integers, the difference is an integer. When either
or both expressions are floating-point numbers, the difference is a floating-point number. The
- (minus) operator is an arithmetic operator with a precedence level of 3.
Example
(Negation): This statement reverses the sign of the expression 2 + 3:
-- Lingo syntax
put(-(2 + 3))
// JavaScript syntax
put(-(2 + 3));
The result is -5.
(Subtraction)
:
This statement subtracts the integer 2 from the integer 5 and displays the result in
the Message window:
-- Lingo syntax
put(5 - 2)
// JavaScript syntax
put(5 - 2);
The result is 3, which is an integer.
(Subtraction)
:
This statement subtracts the floating-point number 1.5 from the floating-point
number 3.25 and displays the result in the Message window:
-- Lingo syntax
put(3.25 - 1.5)
// JavaScript syntax
put(3.25 - 1.5);
The result is 1.75, which is a floating-point number.
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...