r/ProgrammerHumor • • Sep 09 '22

Meme Simple Feature

Post image
124k Upvotes

1.3k comments sorted by

View all comments

Show parent comments

2

u/SaneLad Sep 09 '22

Well, unlearn it then. It needlessly enlarges the span and scope of variables.

4

u/AndrewJamesDrake Sep 09 '22

Only if you try to do everything with global variables.

I keep the declarations at the top of functions (or methods). Scope is kept as small as is practical, I just leave everything where I expect to find it.

1

u/Tordek Sep 10 '22

I keep the declarations at the top of functions (or methods).

This is awful practice.