I've noticed recently that more and more code snippets include variable declarations that happen in the middle of routines. Does this practice have any advantage over declaring all the needed variables at the beginning of a subroutine or function?
thanks all.
g.
thanks all.
g.
Vijaya KadiyalaPosted Apr 13, 2008, 8:34 PM
Hi,
But its always better to delcare all the variabes at one place rather distributing it all the places.
Thanks -- Vj
http://dotnetvj.blogspot.com
AlanPosted Mar 19, 2008, 1:45 PM
No, it's just that some programmers prefer to declare their local variables close to where they're first going to be used.
Others (like me) tend to favour declaring them all at the beginning of the method. It's just a matter of taste and doesn't have any advantage one way or the other.