Home  |  Latest News  |  Contribute  |  F.A.Q.  |  Account  |  Scripts | About
Search ASPNut:
 
ASP Reference
Server Variables
ASP Glossary
Related Sites

Free Components

HTML Reference
Web Colors
Entities
CSS Level 1
Encode/Decode
Glossary

Our Sponsors
ASP Nuke CMS
Free Auctions
PHP 5 Script
Funktastic Blog
ULost Directory
Team Task

 

 

 

 

 

 

 

 

 

 

 

 

Option Explicit

The Option Explicit directive enforces stricter variable definitions in your script. When this statement is placed at the beginning of your script, all variables must be declared before they are used with the Dim statement. If a variable is not defined, the script will throw a runtime error.

The use of Option Explicit is highly encouraged since it allows you to check for variables which you forgot to define. You should make sure and declare all of the variables that are used in your script because it will increase the performance.

It is especially important to declare all of the variables used inside of a subroutine or function. If you fail to declare these variables, they will assume that they are in the global variable scope and could cause conflicts or weird errors in your script.

Option Explicit
Dim sVar

sVar = 10        ' no error here sVar2 = 11        ' throws a runtime error

Orvado Technologies

ASP Nuke CMS
Free Open Source
Content Manager
HomeFix Boards
Home Remodeling
Message Boards

Contact Us | Contribute | About | Site Map



"When your are playing for the national championship, it's not a matter of life or death. It's more important than that." - Duffy Daugherty

©2007 Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.