233

(Shamelessly stolen from reddit)

top 15 comments
sorted by: hot top controversial new old
[-] WiredBrain@lemmy.ca 19 points 2 weeks ago

I'm not CS smart enough to understand this... 😢

[-] edinbruh@feddit.it 42 points 2 weeks ago

"Ternary operator" means "operator that takes three things", like unary and binary operators take one and two things.

In C there is an operator for conditional expressions (an 'if' that you can put inside expressions) and it looks like this condition ? trueBranch : falseBranch. It takes three expressions, so it's a ternary operator.

Except it's the only ternary operator in C (and most languages, if they have one at all), so instead of calling it something like "conditional operator", they just call it "the ternary operator"

[-] MightBeFluffy@pawb.social 25 points 2 weeks ago* (last edited 2 weeks ago)

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

[-] tja@sh.itjust.works 7 points 2 weeks ago* (last edited 2 weeks ago)

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

[-] 48954246@lemmy.world 3 points 2 weeks ago* (last edited 2 weeks ago)

I like the python way as it reads more naturally

a = 2 if isTrue else 9
[-] mobotsar@sh.itjust.works -3 points 2 weeks ago

The joke is that the people in the conversation are kinda dumb

[-] lena@gregtech.eu 1 points 1 week ago
[-] mobotsar@sh.itjust.works -1 points 1 week ago

Well if you make me actually explain it, I'm going to sound like an asshole; the joke is so obvious and low-level and the type of humor so uninspired that I figure they must be a little.. you know, dumb.

[-] andronicus@lemmy.world 2 points 1 week ago

Well if you make me actually explain it, I'm going to sound like an asshole

Too late muchacho... you're already giving real big superiority vibes here

[-] mobotsar@sh.itjust.works 1 points 1 week ago

Yeah.. well, you know.

[-] lena@gregtech.eu 2 points 1 week ago

It's not the best joke I've seen, but I wouldn't call it dumb. To each their own, I guess. Jokes are subjective.

[-] pocker_machine@lemmy.world -3 points 2 weeks ago

Honestly, it is not worth it and only mildly funny. You didn’t miss anything.

[-] lena@gregtech.eu 3 points 1 week ago

Very useful reply 👍

[-] catty@lemmy.world 10 points 2 weeks ago
[-] flambonkscious@sh.itjust.works 5 points 2 weeks ago

To my deranged Friday afternoon brain, this is the funniest bit

this post was submitted on 17 Jul 2025
233 points (87.0% liked)

Programmer Humor

25396 readers
1743 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

founded 2 years ago
MODERATORS