### Assignment Operators

Expressions such as

j = j + 2

in which the left hand side is repeated on the right can be written in the compressed form

j += 2

SPL supports several assignment operators:

 Operator Description += add then assign -= subtract then assign *= multiply then assign /= divide then assign %= modulo then assign >>= bit right shift then assign <<= bit left shift then assign &= bit and then assign |= bit or then assign |^= bit xor and assign @= append then assign @@ concatenate

If e1 and e2 are expressions, then

e1 op= e2

is equivalent to

e1 = (e1) op (e2)

except that e1 is computed only once. Notice the parenthesis.

x *= y + 1

is equivalent to

x = x * (y + 1)

not

x = x * y + 1

Assignment operators are not only fast and concise, they correspond better to the way people think. We say "add 2 to j" or "increment j by 2," not "take j, add 2, then put the result back into j." Thus, j += 2.

The statement:

a = b @@ c

is more compact and equivalent to

a = concat(b, c)

The statement:

a @= b

is equivalent to

append(a, b)

The @= operator appends the series B to the end of series A in place. a @= b is much faster than a = a @@ b for large series because @= operates on the existing series whereas @@ creates and assigns a new series.