Use Local Variables

Within subroutines and functions, you should use local variables rather 
than global variables whenever possible. Local, in this case, means that 
the variables are defined between the sub/function and end sub/function 
statements. Within subroutines and functions, access to local variables 
is faster than to global variables. Plus, it makes for cleaner and more 
readable code and easier debugging.

For example, instead of writing

<%
dim intCounter

function howMany
for intCounter = 1 to 100
next
howMany = intCounter
end function

response.write howMany
%>


you should write this instead:

<%
function howMany
dim intCounter
for intCounter = 1 to 100
next
howMany = intCounter
end function

response.write howMany
%>

You might also like...

Comments

ElementK Journals

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook