Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: Beginner
Jun 6, 2001

Encapsulate Your Main Body in a Main Subroutine

Global variables can lead to problems that are difficult to debug. It is very easy, for instance, to accidentally access a global variable from a function when you think you are using a local variable. All variables that you declare in ASP outside of functions are of global scope to the ASP.

To avoid incidental global variables, you can create a Main subroutine as the entry point for the ASP. Any variables you declare within Main are local to it, so you significantly reduce the number of global variables. Main is then called from within the page as the starting point for the page.
Trong Ha
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date