decr/2 and prev/2—return an integer or enumeration slot value decremented by 1

The decr/2 and prev/2 operations return an integer or enumeration slot value decremented by 1. 

Note

The prev/2 function has the same functionality as decr/2 but is used only on enumeration type slots. This function has been deprecated.

The syntax for decr/2 operation is as follows:

$VAL=decr($SLOT)

decr/2 arguments

Argument

Mode

Type

Description

$SLOT

Input

SLOTREF

Specifies an integer or enumeration slot for which the decremented value is to be returned.
The actual value of the slot is not decremented.

$VAL

Output

INTEGER|ENUM

Value of the slot decremented by 1

Use decr/2 to retrieve the value of the slot referenced in $SLOT decremented by 1 in $VAL. For an enumeration, the slot value returned is decremented to the next lower value. If there is no lower value, the slot value returned remains unmodified.

The referenced slot itself is not modified.

decr/2 example

$NEWPRIO = decr( $E.mc_priority );
Was this page helpful? Yes No Submitting... Thank you

Comments