|
Language: Web Expertise: Beginner
Oct 18, 1999
Always Use Option Explicit
You should always use Option Explicit statement in your .asp file. This
statement will enforce that you explicitly declare all the variables in the
script. The whole problem: VBScript allows you to use
variables without explicitly declaring them. Turning on this option helps
you in identifying undefined variables.
The Option Explicit statement must appear in a script before any procedures.
When you use the Option Explicit statement, you must explicitly declare all
variables using the Dim, Private, Public, or ReDim statements. If you try to
use an undeclared variable name, an error occurs. Using Option Explicit
makes undeclared local variables illegal. Undeclared local variables are as
slow as global variables. Another added advantage of using this statement is
that you move towards a more maintainable code as all the variables are
declared before usage.
Deepak Pant
|