Skip to content

Glossary: Rust Basics

Compound assignment operators

Also written: +=, -=, *=, /=

Shortcuts that change a `mut` variable using its old value: `stock -= 2;` means `stock = stock - 2;`, and `+=`, `*=` and `/=` work the same way.

Where the book teaches it

Related terms

ImmutableVariable