OPERATORS

Subtraction assignment (-=)

Apply subtraction to the current value of the target and the right operand.

Syntax

Signature
target -= value

Description

Apply subtraction to the current value of the target and the right operand. Store the result back in the target. The operand rules are those of -.

Example

Subtraction_assignment.prg
PROCEDURE Main()

   LOCAL nRemaining := 10
   LOCAL nRequest

   FOR EACH nRequest IN { 4, 7, 6 }
      IF nRequest <= nRemaining
         nRemaining -= nRequest
         QOut( "Reserved", nRequest, "remaining", nRemaining )
      ELSE
         QOut( "Short by", nRequest - nRemaining )
      ENDIF
   NEXT

   RETURN

Output