this post was submitted on 13 Dec 2025
643 points (97.6% liked)

Programmer Humor

27898 readers
1926 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
you are viewing a single comment's thread
view the rest of the comments
[–] spongebue@lemmy.world 2 points 4 days ago (16 children)

x = -i;

Do many languages let you do that? When it's in front of a variable I would've expected it to be a subtraction operator only and you would need to do x = -1 * i;

[–] OshaqHennessey@midwest.social 2 points 4 days ago (1 children)

I just tested it in PowerShell. Works fine

$i = 1
$x = -$i
$x

Outputs -1

[–] squaresinger@lemmy.world 2 points 3 days ago (1 children)

Works fine in any language I ever used.

I'm honestly quite surprised that this very basic language feature is even a matter of discussion here.

[–] Sylvartas@lemmy.dbzer0.com 2 points 3 days ago (1 children)

It certainly makes me question a lot of things. This sub somehow manages to both feed my impostor syndrome and makong me feel like a genius programmer depending on the thread.

[–] squaresinger@lemmy.world 2 points 3 days ago* (last edited 3 days ago) (1 children)

Totally, yes. I guess there's a ton of non-programmers and total beginners in this community.

But sometimes there are some crazy good programmers here as well.

What's really weird though is that I got two downvotes a bit further up for claiming that unary minus is a standard language feature.

[–] Sylvartas@lemmy.dbzer0.com 2 points 2 days ago

Yeah I saw that. It's weird because I've used it without a second thought in tons of different languages and never had issues with it

load more comments (14 replies)