--

The -- symbol is used to decrement a variable, i.e. subtract 1 to it. It can be used either in predecrement or postdecrement mode. In predecrement mode, the value of the variable is decreased by one, then used in an expression. In postdecrement mode, the value of the variable is used in the expression, then decremented by one. For example

routine test
{
local i,j,k

   i = 5
   j = --i   ! Line 6
   k = i--   ! Line 7
   print "i="; i ;" j="; j-- ;" k " ! line 8
   k = 9
   j = 8
   i = k-- + j
   print "i="; i ;" j="; j ;" k " ! line 12
   k = 9
   i = --k + j
   print "i="; i ;" j="; j ;" k " ! line 15
}

At line 6, i and j will be equal to 4. At line 7, k will also equal 4, but the value of i will be 3. However, on line 8, j will display as being equal to 4, but after the line is printed, j will be 3. At line 12, i will show as 16, but k will be 8. At line 12, i will show as 17, and k will show as 8.

See Also: ++