OPERATORS

Addition assignment (+=)

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

Syntax

Signature
target += value

Description

Apply addition 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

Addition_assignment.prg
PROCEDURE Main()

   LOCAL nDelta
   LOCAL nStock := 20
   LOCAL cLog := "Stock"

   FOR EACH nDelta IN { 8, -3, -2 }
      nStock += nDelta
      cLog += " -> " + LTrim( Str( nStock ) )
   NEXT
   QOut( cLog )

   RETURN

Output