Note: information on this page refers to Ceylon 1.0, not to the current release.

- (unary minus) operator

The right-associative, unary prefix - operator is used to invert the sign of its operand

Usage

Integer minusOne = -1;

Description

Definition

The - operator is defined as follows:

rhs.negativeValue;

See the language specification for more details.

Polymorphism

The unary - operator is polymorphic. The meaning of - depends on Invertible interface

Type

The result type of the - operator is the same as the Invertible type of its operand.

Meaning of unary minus for built-in types

For the built in numeric types Integer and Float, - just changes the sign.

See also