unaryMinus#
Inverse the sign of a value. Converts booleans and strings to numbers.
Available in: math cells, REPL.
Syntax#
-x
unaryMinus(x)
Arguments and behavior#
Arguments must match one of the syntax forms above. Use the example as a starting point; arrays and numeric types are accepted only by compatible overloads. The example returns scalar (number).
Example#
Edit the inputs, then use Run or Reset. Changes stay in this example.
Example
unaryMinus(2)Interactive examples could not load. You can still copy the expressions.
Expected result: -2.