Pike v8.0 release 1738

Method `~()


Method `~

mixed `~(object arg)
int `~(int arg)
float `~(float arg)
type `~(type|program arg)
string `~(string arg)

Description

Complement/inversion.

Every expression with the ~ operator becomes a call to this function, i.e. ~a is the same as predef::`~(a).

Returns

The result will be as follows:

arg can have any of the following types:
object

If arg implements lfun::`~(), that function will be called.

int

The bitwise inverse of arg will be returned.

float

The result will be -1.0 - arg.

type|program

The type inverse of arg will be returned.

string

If arg only contains characters in the range 0 - 255 (8-bit), a string containing the corresponding 8-bit inverses will be returned.

See also

`!(), lfun::`~()