Futurebasic/Language/Reference/dec
DEC statement
[edit | edit source]DEC
[edit | edit source]Statement
[edit | edit source]✔ Appearance ✔ Standard ✔ Console
Syntax
[edit | edit source]DEC(intVar)
numericVariable --
numericVariable -= valueToSubtract
Revised
[edit | edit source]May 30, 2000 (Release 3)
Description
[edit | edit source]This statement decrements intVar
by 1 (or by valueToSubtract
); that is, it subtracts 1 from the value of intVar
, and stores the value back into intVar
. intVar
must be a (signed or unsigned) byte variable, short-integer variable or long-integer variable. If intVar
is already at the minimum value for its variable type, then DEC(intVar)
will cycle it back to its maximum value. As of Release 3, FB supports the use of -= to decrease the value of a variable by a specified amount.
Example
[edit | edit source]DEC(x&)
and...
x& -= 1
and...
x& --
...are all equivalent to:
x& = x& - 1
The following expressions are also equivalent:
x& = x& - 100
x& -= 100
Note
[edit | edit source]The -=
syntax may not be used for arrays of strings, containers, or records where arrays are involved, only numeric values may take advantage of this syntax.
See Also
[edit | edit source]INC; DEC LONG/WORD/BYTE; DEF CYCLE