this post was submitted on 04 Dec 2024
87 points (89.2% liked)

Programmer Humor

19833 readers
200 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
 
top 15 comments
sorted by: hot top controversial new old
[–] [email protected] 21 points 3 weeks ago

Tell me you’re a JavaScript StackOverflow copy-pasta noob without telling me you’re a JavaScript StackOverflow copy-pasta noob.

[–] Scoopta 13 points 3 weeks ago (3 children)

I don't get it? When has this ever fixed a bug? Compiler error sure? But a bug?

[–] [email protected] 8 points 3 weeks ago (1 children)

I actually had a bug in a game jam freshman year because of this. It was java, so there was a lot of questionable decisions going on, but adding the semicolon fixed it!

[–] Scoopta 3 points 3 weeks ago (1 children)

...I want details. Java is my most used language and I want to know lol

[–] [email protected] 1 points 3 weeks ago (1 children)

… now that I’m thinking harder it may have been a colon? The real problem was that we’d only been programming a few months at that point and were pretty good at accidentally fucking up syntax

[–] Scoopta 1 points 3 weeks ago

Ah, I mean syntax issues trigger compiler errors though. I'm not sure of one that compiles but has odd behavior... except the increment/decrement operators. Maybe I'm just not remembering one

[–] [email protected] 5 points 3 weeks ago (1 children)

Semicolons are technically optional in JS, but there are some rare cases where omitting them can result in different behaviour.

And this is why you should enforce code style, kids. Preferably with an automated tool.

[–] [email protected] 1 points 2 weeks ago* (last edited 2 weeks ago)

I'm on my phone rn so can't format well, but one such example is:

const thing = require("module")

(async () => { something })()

without a ; at the end of the first line, JavaScript will try to do require("module")() instead

[–] jwt 1 points 3 weeks ago

I don't get the semicolon either, may be a language barrier. used question marks like this for optional chaining in typescript though...

[–] tatterdemalion 13 points 3 weeks ago

This type of shit makes me aware that there really are devs that don't care about efficiency and will spend weeks on some really novice shit because their tools and skills are bad.

[–] [email protected] 4 points 3 weeks ago

print("here");

[–] 0x0 2 points 3 weeks ago

Good tip for Pascal.

[–] [email protected] 1 points 2 weeks ago

but what if yoj use python? or basic? or bash? or batch? or asm?

[–] [email protected] 1 points 3 weeks ago (1 children)
[–] [email protected] 1 points 3 weeks ago

Yeah I use python