Operator Expressions

Syntax

<operator-expr> ::=
      | <assignment-expr>

Assignment Expressions

Syntax

<assignment-expr> ::= <expr> = <expr>

The expression on the left of the = must be an lvalue. Following in the style of C, the result of an assignment expression is the rhs.

// assigns `x` to 5
// main also evaluates to 5
fn main() -> int {
    let x = 0;
    x = 5
}