operator

Rust *: multiply values

Multiply a quantity by a unit price or scale factor with `*`. The result of primitive integer multiplication retains the operand type. Expected output (not executed): 48 Why: Six groups of eight contain 48 items. Common mistake: `*` between numbers is multiplication; prefix `*reference` means dereference. Advanced connection: `std::ops::Mul`; `MulAssign` for `*=`.

Formal Syntax & Structure

rust syntaxrust
a * b

Working Example

Example Snippetrust
fn main() {    let boxes = 6;    let items_per_box = 8;    println!("{}", boxes * items_per_box);}
Rust Reference