760
you are viewing a single comment's thread
view the rest of the comments
[-] FooBarrington@lemmy.world 75 points 1 month ago
try {
    operation();
} catch {
    // nice weather, eh?
}
[-] Karyoplasma@discuss.tchncs.de 15 points 1 month ago* (last edited 1 month ago)

Starting with Java 21 (I think), they've introduced ignored variables, so you can now actually do this:

try {
    operation();
} catch (Exception _) {
    // nice weather, eh?
}

Edit: forgot that this is about JS lel

So basically the same as a discard in C#?

[-] Karyoplasma@discuss.tchncs.de 2 points 1 month ago* (last edited 1 month ago)

Yeah, Python has it as well. I think the only real use of it is code readability since you declare that this variable will never be used.

[-] __ghost__@lemmy.ml 2 points 1 month ago
[-] Traister101@lemmy.today 2 points 1 month ago

If your joking yes, if your not Java and Java Script are seperate things.

[-] dajoho@sh.itjust.works 2 points 1 month ago
[-] JustAnotherKay@lemmy.world 1 points 1 month ago

Actually made this mistake in front of 20 people the other day. Guy at my job mentioned coding in java and I asked if he was doing web dev 🤦

[-] BangersAndMash@lemmy.world 2 points 1 month ago* (last edited 1 month ago)

Plenty of java back end web development, so maybe not as embarrassing as you felt?

[-] JustAnotherKay@lemmy.world 1 points 1 month ago

He said "I've been closing in C# and Java for 2 years" and I asked, in front of everyone, "are you doing web dev?" And he just coldly said no

See this could have been fine if I didn't double down and go "then what are you using java for... OH WAIT"

[-] DjMeas@lemm.ee 10 points 1 month ago

☑️ PR Approved

[-] MajorHavoc@programming.dev 5 points 1 month ago

Thanks. I hate it.

[-] lengau@midwest.social 3 points 1 month ago
with contextlib.suppress(BaseException):
    do_thing()
this post was submitted on 17 Jan 2025
760 points (99.0% liked)

Programmer Humor

20033 readers
297 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