650
you are viewing a single comment's thread
view the rest of the comments
[-] OshaqHennessey@midwest.social 2 points 10 months ago

I just tested it in PowerShell. Works fine

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

Outputs -1

[-] squaresinger@lemmy.world 2 points 10 months ago

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 10 months ago

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 10 months ago* (last edited 10 months ago)

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 10 months 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

this post was submitted on 13 Dec 2025
650 points (97.7% liked)

Programmer Humor

33716 readers
1024 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 3 years ago
MODERATORS