this post was submitted on 07 Oct 2025
170 points (91.3% liked)
Programmer Humor
26860 readers
2411 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I prefer if-expressions where possible. For example, this is valid Rust:
(Can also be on a single line.)
This is the same syntax as the normal if-statement, except the compiler forces you to add an else-branch, if you want to 'return' a value from it.
Don't tell anyone, but the ternary operator is when the C designers realized that being purely procedural is cumbersome AF. ๐
Unfortunately, they decided that expressions need to look like math, so now JS devs get to write random question marks and colons across many, deeply nested lines of code.