## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

### Unary Operators

In contrast to binary operators, unary operators are only applied to one operand. The following sections look closer at the unary plus (+), the unary minus (-), the increment (++), and the decrement (--) operators.

#### Unary Plus and Unary Minus

The unary minus operator shown in the following

is not just a minus sign, as in the literals (like –18) we write on a piece of paper. It is an operator and will change the sign of the numerical expression to which it is applied. Consequently, if the variable height has the value 10, - height will return the value –10. If the value is –10, the result will be 10.

Note

 When the unary minus operator ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required