+=, -=, *=, /=
These are compound assignment forms of the ordinary arithmetic operators.
Syntax
x += y
x -= y
x *= y
x /= y
Equivalent Expressions
x = x + y
x = x - y
x = x * y
x = x / y
Operands and Result
Allowed types: SCAL, VCT, AUD, TEXT, TSEQ, NUL
Not allowed: CLASS, CELL
| x | y | x becomes |
|---|---|---|
NUL | allowed type | that type |
SCAL | allowed type | that type |
VCT | VCT | VCT |
AUD | VCT | AUD |
VCT | AUD | AUD |
TSEQ | VCT | TSEQ |
TSEQ | AUD | not allowed |
AUD | TSEQ | AUD |
Notes
- These operators update the left-hand side in place using the corresponding arithmetic operation.
- They are not commutative because the left-hand side is the value being reassigned.
- For behavior details of the underlying arithmetic operations, see
+and-and*and/.
Examples
AUX> x=rand(5)
x =
0.5853 0.2218 0.6290 0.1231 0.2736
AUX> x*=10
x =
5.8531 2.2182 6.2896 1.2313 2.7363
AUX> x=tone(500,100).hann@-20
x =
audio (0.0ms~100.0ms)
AUX> y=noise(10)@-10>>40
y =
audio (40.0ms~50.0ms)
AUX> x += y
x =
audio (0.0ms~100.0ms)


Current source basis:
compop_arith.html