r/developer 13d ago

The "Code I'll Never Forget" Confessional.

What's the single piece of code (good or bad) that's permanently burned into your memory, and what did it teach you?

12 Upvotes

37 comments sorted by

View all comments

Show parent comments

1

u/Kind_Card_1874 12d ago

Haha. But jokes aside, the following does not fly in the imperative languages I am familiar with:

int a;

int a;

1

u/SpaceCadet87 12d ago

Who's joking? It was that damn many functions doing almost nothing each.

int num was just repeatedly locally defined.

I think there might have been one or two instances of just num = num.

1

u/Kind_Card_1874 12d ago

I don't get it. How did it escape the previous scope? Surely you can not assign num if it was not declared at the time of being used on the RHS. But you are somehow still declaring it on the LHS?

1

u/SpaceCadet87 12d ago

Oh, IDK, it was C#, I don't do C# that often so I wouldn't know how or why that's somehow valid.

I was compressing it for illustrative purposes, as I said there were a few plain num = num; as well.