Binary Operator Shorthands

Binary Operator Shorthands  --  (+=, -=, *=, /=, %=, &=, ^=, <<=, >>=)

Syntax

symbol += number
symbol -= number
symbol *= number
symbol /= number
symbol %= number
symbol &= number
symbol ^= number
symbol <<= number
symbol >>= number
		

Arguments

symbol

A symbol with a numeric value.

number

Any integer or real number.

Returns

The value of the symbol as operated on with the number.

Description

These operators provide a shorthand way of reassigning values to symbols.

+= gives the sum of the symbol and the number.

-= gives the difference between the symbol and the number.

*= gives the product of the symbol and the number.

/= gives the symbol divided by the number.

% gives the modulus of the symbol by the number, that is, the remainder of the integer division of the symbol by the number.

&= performs the & operation on the symbol and the number.

^= performs the ^ operation on the symbol and the number.

<<= performs the << operation on the symbol and the number.

>>= performs the >> operation on the symbol and the number.

Example

    Gamma> a = 5;
    5
    Gamma> a += 8;
    13
    Gamma> a;
    13
    Gamma> 
    		

See Also

Arithmetic Operators, Assignment Operators, Bitwise Operators

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.