DECR statement

Purpose | Decrement a variable by 1; Decrement a pointer by the size of its target; or decrement the target of a numeric pointer by 1.
Syntax | DECR variable

Remarks

variable can be a numeric variable or a pointer variable. When DECR is used with a numeric variable, 1 is subtracted from the numeric variable.

If DECR is used on the target of a numeric pointer variable (i.e., DECR @IntPtr), the target numeric variable is decremented by one. However, when using DECR on a pointer variable, the value of the pointer variable is decremented by the size of its target.

For example, given a pointer to element 1000 of an Integer array, DECR of the pointer variable itself would result in a decrement of 2, which should point to the previous element in the array (element 999). This is because an Integer is two bytes wide, so the pointer value is reduced by 2 bytes.

See also | INCR, LET
Example | DIM x&, LongPtr AS LONG POINTER DECR x& DECR LongPtr DECR @LongPtr