this post was submitted on 21 Jun 2023
5 points (100.0% liked)

Programmer Humor

36984 readers
312 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 7 comments
sorted by: hot top controversial new old
[–] azimir@lemmy.ml 1 points 2 years ago (1 children)

This is a great one. I'm definitely using it in class this fall to explain static variables.

[–] DonjonMaister@programming.dev 1 points 2 years ago

Fun fact: I made this meme to explain my classmates static variables.

[–] tiredofsametab@kbin.social 1 points 2 years ago

Perl actually uses my and our to do scope.

my @foo;

our $bar;

[–] jdr@lemmy.ml 0 points 2 years ago (1 children)

Young man, could.you explain your shitpost?

[–] fiah@discuss.tchncs.de 0 points 2 years ago (1 children)

int variable => local scope => my int from the perspective of an instance

static int variable => class scope => our int, for all instances of a class

[–] Bear_with_a_hammer@lemmy.ml 1 points 2 years ago (1 children)

You know what's funny? In PHP it's backwards :D

[–] fiah@discuss.tchncs.de 1 points 2 years ago

well of course it is!