Skip to content

Decrement

See Also: Increment, Integer, Repeat, While

Purpose

To reduce the value of a variable or database field by one.

Syntax

Decrement {variable}

Where {variable} is any integer, date, or numeric variable or a numeric or date database field.

What It Does

The Decrement command subtracts one from the value of {variable}. It works with any variable or field that contains a date or numeric value.

The Decrement command is especially useful for maintaining descending counters, particularly those that control While ... End, Repeat ... Until, and similar structured loops.

Example

Procedure CountDown Integer iFromWhatNumber
    Integer iCounter
    Move iFromWhatNumber to iCounter
    Repeat
        Showln iCounter "."
        Decrement iCounter
    Until (iCounter < 1)
End_Procedure