Decrement

x--

decreases the value of x by 1, returning the old value of x.

Details

Examples

open allclose all

Basic Examples  (1)

Decrement the value of k by one, but return the old value:

Scope  (3)

Decrement a numerical value:

Decrement a symbolic value:

Decrement all values in a list:

Applications  (1)

Find the largest prime smaller than a given number:

Properties & Relations  (4)

Decrement and PreDecrement differ in the return value of the operation:

Decrement is a short form of this assignment:

Decrement is a special case of SubtractFrom:

Increment and PreIncrement are closely related operations:

Possible Issues  (1)

A variable to be decremented must have an initial value:

Introduced in 1988
 (1.0)