The Dec procedure subtracts one or N from a variable.

Dec(X) corresponds to X := X - 1, and Dec(X, N) corresponds to X := X - N.

X is an ordinal-type variable or a variable of type PChar if the extended syntax is enabled, and N is an integer-type expression.

Dec generates optimized code and is especially useful in a tight loop. Example var

IntVar: Integer; LongintVar: Longint; begin

Dec(LongintVar, 5); { LongintVar := LongintVar - 5 }

0 0

Post a comment