Negate numerical value of an expression.
A UnaryExpr
consists of the unary operator and an
expression. The expression is
atomized so that
it is either a single atomic value or an empty sequence. If it is an empty
sequence, the result of the operation is also an empty sequence.
The unary operator has higher precedence than binary operators.
An atomic integer value:
- 3
This is different from -3
, since that is interpreted as a
single atomic value, while - 3
is parsed as a unary expression.
Effectively, both expressions yield the negative integer value
-3
.
Change the sign of the numeric value -3:
-(-3)
Subtract the year of birth of each patient from 2004 and change it to a negative value:
for $a in input()/patient/born return -(2004 - $a)
The following construct(s) refer to this construct: