Where to place variables ?

ProgMan

Well-known member
Joined
Nov 25, 2006
Messages
55
Location
UK
Programming Experience
3-5
Hello :)

Is it a good idea to declare variables right before using it or should we declare all variables at the beginning of the code (like in C) ? Whats the standard or good practise ?

Thanks.

Edit : Perhaps I should've put this question in the VB.NET section. (dunno what's happened to me today ! :eek: )
 
I try to always declare all needed variable at the top of each module or routine (sub/function)

that way before getting into the code that uses those variables, I know what all the sub/function or the class needs/uses
 
Back
Top