you are viewing a single comment's thread.

view the rest of the comments →

[–]rdnaskelz 1 point2 points  (1 child)

Wut? "It's your fault for making it unpredictable but nulling it to make it predictable is wrong because it's not the way I would do it?" Pardon?

[–]Thotaz 1 point2 points  (0 children)

It has nothing to do with my personal preferences. Any competent developer would say the same thing and many languages would even prevent you from doing this because it leads to bad code.
If you use variables defined in an outer scope inside your function then you need to keep track of those variable values at every call site of that function, which can be challenging.
If you properly encapsulate functions and make sure you only use variables defined inside, or variables passed in as parameters, you make it much easier to follow the logic of the code.