Scope of variables in a function

Anthony Lucas anthonyjlucas at gmail.com
Sat Jun 1 19:15:30 BST 2013


On 1 June 2013 18:58, Andrew Beverley <andy at andybev.com> wrote:

> I try to avoid separately declaring variables where
> possible, as IMHO it clutters the code.
>
>
Cluttered !== Less Lines of Code
I would suggest re-adjusting your concept of cluttered.

I would call any statement including a declaration, doing anything other
than declarations to be the more cluttered option.


On 1 June 2013 19:03, Andrew Beverley <andy at andybev.com> wrote:
>
>
> Thanks for that. Obviously I should have RTM, but it does seem strange
> that something that is not recommended does not produce any sort of
> warnings.
>
>
It's not that it's not recommended, it's just that it's usually not what
you meant. There's nothing objectively wrong with not reinitialising a
variable on every call into your function.


More information about the london.pm mailing list