Progress supports + / - * as operators. They cannot be overloaded. Division always returns a decimal. If any of the numbers in a calculation is a decimal a decimal will be returned. Otherwise an INTEGER
or INT64
.
There's no +=
or ++
operator. To increase or decrease a variable you have to assign it to itself plus or minus something. So to add 1 to a variable you do: i = i + 1.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE j AS INTEGER NO-UNDO.
i = 3.
j = 2.
DISPLAY i + j. // 3 + 2 = 5
DISPLAY i - j. // 3 - 2 = 1
DISPLAY i / j. // 3 / 2 = 1.5
DISPLAY INTEGER(i / j). //Integer(3/2) = 2.
DISPLAY i * j. //3 x 2 = 6