this post was submitted on 17 Jul 2025
232 points (87.2% liked)
Programmer Humor
25180 readers
1682 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'm not CS smart enough to understand this... ๐ข
A ternary is a short hand to assign a value based on a true/false statement
let a; if(isTtrue) a=2 else a=9
Becomes
let a = (isTrue) ? 2 : 9
I really like the way kotlin is doing it. The readability of the first one and still a direct assignment.
var a = if (isTrue) 2 else 9
I like the python way as it reads more naturally