Compound Assignment Operator
let mut k = 9;
let mut l = k;
Operator | Description |
---|---|
k += l |
Add a value and assign, then k=9 |
k -= l |
Substrate a value and assign, then k=18 |
k /= l |
Divide a value and assign, then k=9 |
k *= l |
Multiply a value and assign, then k=81 |
k |= l |
Bitwise OR and assign, then k=89 |
Comments