Progress
Language Reference


– Unary Negative Operator

Interfaces
OS
SpeedScript
All
All
Yes

Reverses the sign of a numeric expression. Do not confuse this operator with the subtraction operator that subtracts one expression from another.

SYNTAX

- expression 

expression

An expression whose value is numeric.

EXAMPLE

If you supply a negative value for the variable x, the example procedure uses the unary negative operator (-) to reverse the sign of x, producing the absolute value of x (abs-x).

r-uneg.p
DEFINE VARIABLE x AS DECIMAL LABEL "X".
DEFINE VARIABLE abs-x AS DECIMAL LABEL "ABS(X)".

REPEAT:
  SET x.
  IF x < 0
  THEN abs-x = -x
  ELSE abs-x = x.
  DISPLAY abs-x.
END. 


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095