❮ Toggle
❯
if-else returns a value
- This expersssion must have an else part!
- The last statement in both the if and the else part has no ; at the end and thus they are called expressions and not statements.
examples/booleans/if-returns-value/src/main.rs
fn main() { let x = 1; let y = 2; let z = if x < y { x + y } else { x * y }; println!("{z}"); }