Statements & Expressions

202307071422
Status: #idea
Tags:

Statements & Expressions

Statement
Instructions that perform an action and do NOT return a value

Expression
Evaluate to a resultant value

Info

Function definitions are also statements

Warning

Assignment does not return a value in Rust.
let x = y = 5 is invalid.

// y = 4
let y = {
	let x = 3;
	x+1;
};

References

  1. https://rust-book.cs.brown.edu/ch03-03-how-functions-work.html#statements-and-expressions