![]() ![]() | |
Flash Player 5.
~ expression
expression A number.
None.
Operator (bitwise); converts the expression to a 32-bit unsigned integer, then inverts the bits. A bitwise NOT operation changes the sign of a number and subtracts 1.
The following example shows a bitwise NOT operation performed on a variable.
a = 0;
trace ("when a = 0, ~a = "+~a);
// when a = 0, ~a = -1
a = 1;
trace ("when a = 1, ~a = "+~a);
// when a = 0, ~a = -2
// therefore, ~0=-1 and ~1=-2
![]() ![]() | |