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

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

The Decrement command is especially useful for maintaining descending counters, especially those which 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