739
ifn't (programming.dev)
top 50 comments
sorted by: hot top controversial new old
[-] 0x0@lemmy.dbzer0.com 200 points 10 months ago

I propose a new, more threatening kind of control flow.

do {
  /* something */
} or else {
  /* you don't want to find out */
}
[-] gex@lemmy.world 57 points 10 months ago

Some C++ style guides suggest the following naming convention for functions that crash on any error

OpenFileOrDie()
[-] xmunk@sh.itjust.works 25 points 10 months ago

PHP has the always wonderful (and perfectly functional) syntax of

logUserIn() or die();

load more comments (4 replies)
load more comments (6 replies)
[-] Strawberry 38 points 10 months ago

this is just a menacing try/catch!

[-] moody@lemmings.world 21 points 10 months ago

It_would_be_a_shame_if(condition)

load more comments (5 replies)
[-] OpenStars@startrek.website 101 points 10 months ago

Please God let this be a humorous post that somehow does not also find a way to manage to come true...

[-] jtk@lemmy.sdf.org 84 points 10 months ago* (last edited 10 months ago)

I would have bought it if they said ifnot instead, it's the same number of characters and wouldn't require a major parser overhaul to support keywords with a ' in the name.

[-] pupbiru@aussie.zone 43 points 10 months ago

i mean, “unless” tends to be the usual term for an “if not” keyword in languages that implement such a thing

[-] Fal@yiffit.net 23 points 10 months ago

Which is awful and incredibly confusing. I hate ruby

load more comments (4 replies)
[-] OpenStars@startrek.website 15 points 10 months ago

Yeah, to be clear, I don't like it, I don't like it one bit:-P.

load more comments (2 replies)
load more comments (2 replies)
[-] bappity@lemmy.world 97 points 10 months ago* (last edited 10 months ago)
[-] runner_g 47 points 10 months ago* (last edited 10 months ago)

nocap(frfr){

}

[-] MagicShel@programming.dev 73 points 10 months ago

Reduce exclamation marks!? Great Scott!!!!! Is there a shortage of punctuation in the future!?

[-] KairuByte@lemmy.dbzer0.com 21 points 10 months ago

You could have saved two, all you had to do was use the interrobang. You’re a monster.

[-] jaybone@lemmy.world 13 points 10 months ago
[-] SubArcticTundra@lemmy.ml 12 points 10 months ago

All known deposits were depleted

load more comments (1 replies)
[-] ohlaph@lemmy.world 52 points 10 months ago
aint (something) {
    somethingElse()
}
load more comments (3 replies)
[-] lung@lemmy.world 38 points 10 months ago
[-] Deconceptualist@lemm.ee 38 points 10 months ago

I believe that resolves the same as

ain't!(!untrue)

[-] rimjob_rainer@discuss.tchncs.de 37 points 10 months ago* (last edited 10 months ago)

Why not just ifnot? Same count of characters but an o instead of a possibly problematic single quote.

[-] Ookami38@sh.itjust.works 18 points 10 months ago

I think it's just capitalizing on a trend to add n't to otherwise noy contractions, to make them into contractions. Contractionn'ts, if you will

[-] Ferk@kbin.social 16 points 10 months ago* (last edited 10 months ago)

Yes... how is "reducing exclamation marks" a good thing when you do it by adding a ' (not to be confused with , ´,or’` ..which are all different characters).

Does this rely on the assumption that everyone uses a US QWERTY keyboard where ! happens to be slightly more inconvenient than typing '?

[-] KmlSlmk64@lemmy.world 15 points 10 months ago

If someone really wanted to add it, probably the best would be to use unless

[-] JoshuaEN@lemmy.world 10 points 10 months ago

I really liked having unless in Ruby; a ! can be easy to miss, while unless made it clear without needing to write out != true.

load more comments (1 replies)
[-] xmunk@sh.itjust.works 35 points 10 months ago

Still not as good as whence

[-] fartsparkles@sh.itjust.works 14 points 10 months ago

Is this a reference to something because I’d love to read it if you have a time to share.

load more comments (4 replies)
load more comments (1 replies)
[-] janabuggs@beehaw.org 30 points 10 months ago

I'm struggling to understand if this is true or ifn't true

[-] xia@lemmy.sdf.org 30 points 10 months ago

"Help's with readability"? You know what else helps? Not using contractions and introducing an unbalanced single quote.

[-] bdonvr@thelemmy.club 40 points 10 months ago

If they'd'nt've done that, it'd've been better. Agreed.

load more comments (2 replies)
load more comments (2 replies)
[-] csm10495@sh.itjust.works 27 points 10 months ago

Imagine the regex needed to highlight code with that extra single quote.

[-] taanegl@beehaw.org 24 points 10 months ago

I'm just hoping this paves the way to code with Southern dialect

iffun is == true
iffun ain't == false
[-] timetravel@lemmings.world 21 points 10 months ago

May I introduce you to the joys of #define and creating your own horrible sub language

load more comments (1 replies)
[-] olafurp@lemmy.world 23 points 10 months ago

I'd take a not or "if not" operator tbh.

load more comments (7 replies)
[-] Thcdenton@lemmy.world 17 points 10 months ago
load more comments (1 replies)
[-] jtk@lemmy.sdf.org 16 points 10 months ago* (last edited 10 months ago)
ifn't (myNum don't= 3 && myStr ain'tnull'rblankish)
[-] felbane@lemmy.world 14 points 10 months ago

Please remain calm, we are sending paramedics to your location.

load more comments (1 replies)
load more comments (1 replies)
[-] AlmightySnoo@lemmy.world 13 points 10 months ago* (last edited 10 months ago)

reminds me of #ifndef instead of #if !defined(...)

[-] PanArab@lemmy.world 11 points 10 months ago* (last edited 10 months ago)

This can't be for real. I'll stick with C11 thank you.

[-] stardreamer 25 points 10 months ago

Here you dropped this:

#define ifnt(x) if (!(x))
[-] lurch@sh.itjust.works 10 points 10 months ago

i assume "ifnot" wasn't edgy enough and makes inferior noises on custom mechanical keyboards? /s

[-] fl42v@lemmy.ml 9 points 10 months ago* (last edited 10 months ago)

This has to be illegal. I mean, it's basically suicide incitement (or whatever is the phrase for it)

[-] tiredofsametab@kbin.social 9 points 10 months ago

die unless $keyword == "unless";

load more comments (2 replies)
load more comments
view more: next ›
this post was submitted on 18 Jan 2024
739 points (100.0% liked)

Programmer Humor

19623 readers
2284 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 1 year ago
MODERATORS