There are also unary operators, that serve as a prefix for a value and perform
an operation on it. !
inverts a boolean value (so true
becomes false
and
vice-versa), while -
negates a number.
The operator does not affect the actual value the operator is applied to. In this
case, we have a pair of val
values, which are read-only ("immutable") and cannot
be changed. The unary operators affect the use of the values where the operator
appears.
You can learn more about this in:
Tags: