- instructions that perform an action and do not return a value
- ends with semicolon
;
- examples:
- creating a variable and value assignment
let x = 6
- function definition itself is a statement
fn main() {
let y = 6;
}
- expressions evaluate to a resultant value
- expression can be part of a statement e.g. can be assigned as a value to a variable
- expression does not have a semicolon at the end of line
- examples:
- number
6 in statement let x = 6 is an expression that evaluates to 6
- calling function is an expression
if itself is an expression
fn main() {
let y = {
let x = 3;
x + 1 // an expression
};
}