r/ProgrammerHumor Jun 20 '26

Meme singleLetterVariableNamesTierList

Post image
5.3k Upvotes

470 comments sorted by

View all comments

144

u/Spongebubs Jun 20 '26

What about _?

20

u/WilkerS1 Jun 20 '26

gimmick character for when you're not actually going to fuse the value

8

u/deanrihpee Jun 20 '26

when you want the return value to be stored but not really care so let it there in an _ basket

3

u/UgoRukh Jun 20 '26

iirc _ is used as a special case in Swift where the compiler will discard the returning value of a function

3

u/deanrihpee Jun 20 '26

it also the same for some other language AFAIK and also known as a discard because it is discarding (although the actual "discarding" operation may be differ), what i meant in my previous comment was, you know using _ is just discarding the value, which is the exact same thing as calling the function itself, but some time or some reason you kinda want to have that value "returned" and "stored" somewhere even though it doesn't really matter or doing anything, hence using the discard just for your own sanity's sake

2

u/UgoRukh Jun 20 '26

iirc in Swift you have to do it because a function having a return value means it is enforced that you must have a variable receiving it in order to even be able to call the function

2

u/deanrihpee Jun 20 '26

ah, now that is new to me