Note: information on this page refers to Ceylon 1.0, not to the current release.
+ (unary plus) operator
The right-associative, unary prefix + operator is used to clarify the positive value
of its operand.
Usage
Integer one = +1;
Description
Note that + does not change the sign of a negative number:
Integer minusOne = +(-1);
Definition
The + operator is defined as follows:
rhs.positiveValue;
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 plus for built-in types
For the built-in numeric types
Integer and
Float, +
is essentially a no-op.
See also
-
-(unary minus) which does change the sign of its operand - API documentation for
Invertible - arithmetic operators in the language specification
- operator precedence in the language specification
- Operator polymorphism and Numeric operator semantics in the Tour of Ceylon