Undocumented Unary Minus Operator


#1

Even though it is not documented in the Help file, the unary minus operator is supported in both Panorama X and in the previous Panorama 6. The unary plus operator is not supported (it produces a syntax error) and is really not of any practical use as far as I can tell anyway.

Here is an example of using the unary minus operator showing the negation of its operand’s value:

local myValue
myValue = 1548.69
myValue = -myValue
message myValue // output -1548.69
myValue = -myValue
message myValue  // output 1548.69

Not sure how often this would be used not being that mathematically adept but, nonetheless, it is an available tool for your use.


#2

If you are using negative numbers, it would be difficult to avoid its use. A simple statement like

myValue = -1548

uses it. It appears that Panorama X does not consider that - sign to be part of the number. It first determines the value of 1548, and then it applies the unary minus to it. Whether that is also true for floating point values, I can’t say. I couldn’t figure out a way to test for that.