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

Free Components

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, San Diego Web Design

ASP Nuke CMS
Free Open Source
Content Manager
GoSwap Auctions
Buy, Sell
No Fees!

Contact Us | Contribute | About | Site Map



"Life is wasted on the living." - Douglas Adams

©2012 San Diego Web Design - Orvado Technologies, All Rights Reserved
ASP Nut provides articles and reference documentation for Active Server Page developers.