Language / Expression statements

Expression statements

Many expressions can appear as standalone statements when followed by ; (assignment, calls, ++/--, and other “statement-like” expressions).

Full reference: flow expression statements.

Notes#

Example: assignment + increment#

fn main () -> int {
  let mut x: int = 0;
  x += 1;
  ++x;
  return x;
}

See also#

Source repository · Edit this page · View Markdown