Conditional (Ternary) operator



examples/booleans/ternary/src/main.rs
fn main() {
    let b = true;
    let answer = if b { 1 } else { 2 };
    println!("{answer}");

    let b = false;
    let answer = if b { 1 } else { 2 };
    println!("{answer}");
}

1
2