this post was submitted on 08 Jun 2025
483 points (97.4% liked)

Programmer Humor

36300 readers
899 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] Ephera@lemmy.ml 1 points 5 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" };