• Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 hours ago

    The conventional ternary is structured like a normal if-else. In fact, in many languages with functional influence, they’re the same thing.

    For example, you can write this in Rust:

    let vegetable = if 3 > 4 { "Potato" } else { "Tomato" };