Operators > ~ (bitwise NOT)

~ (bitwise NOT)

Syntax

~ expression

Arguments

expression Any number.

Description

Operator (bitwise); converts the expression to a 32-bit unsigned integer, then inverts the bits. Or, simply said, changes the sign of a number and subtracts 1.

A bitwise NOT operation changes the sign of a number and subtracts 1.

Player

Flash 5 or later.

Example

The following is a numerical explanation of a bitwise NOT operation performed on a variable:

~a, returns -1 if a = 0, and returns -2 if a = 1, thus:

~0=-1 and ~1=-2