Library code snippets
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
%>
Related articles
Related discussion
-
Read eMails from Outlook express using ASP
by kumaravelu (1 replies)
-
Help to Call ASP function from onclick event in HTML to pass an array
by vka (0 replies)
-
Binary Studio | software development outsourcing Ukraine
by shane124 (4 replies)
-
Variable In Vb.Net
by chia (0 replies)
-
ideas in building a captive portal
by sjranjan (2 replies)
Related podcasts
-
Scott Guthrie
Scott catches up with Scott Guthrie in an interview covering Ajax, Asp 2.0, extender controls, CSS adapters and more.
This thread is for discussions of Use Local Variables.