 




<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>The VBScript Network and Systems Administrator&#039;s Cafe &#187; option explicit</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/option-explicit/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator</link>
	<description></description>
	<lastBuildDate>Tue, 11 Oct 2011 18:36:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>VBScript Statements: Explanation of the Option Explicit Statement</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-option-explicit-statement/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-option-explicit-statement/#comments</comments>
		<pubDate>Mon, 26 May 2008 15:48:07 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[option]]></category>
		<category><![CDATA[option explicit]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[VBScript Statements]]></category>
		<category><![CDATA[vbscriptstatements]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-option-explicit-statement/</guid>
		<description><![CDATA[In VBScript declaring your variables up front is not required (as stated in this sites explanation of the Dim Statement), however, many programmers choose to declare their variables up front to avoid having to track down misspellings in their code. They go further by adding the Option Explicit statement to force them to do so. [...]]]></description>
				<content:encoded><![CDATA[<p>In VBScript declaring your variables up front is not required (as stated in this sites explanation of the Dim Statement), however, many programmers choose to declare their variables up front to avoid having to track down misspellings in their code. They go further by adding the <strong>Option Explicit</strong> statement to force them to do so. With Option Explicit turned on and error is thrown when a variable is used before being declared.</p>
<p>Consider the following code, that doesn&#8217;t use <strong>Option Explicit</strong>:</p>
<p><font color="#0000ff">TheFirstVariable = 1<br />
TheSecondVariable = 2<br />
TheThirdVariable = TehFirstVariable + TheSecondVariable</font></p>
<p><font color="#0000ff">Wscript.echo TheThirdVariable</font></p>
<p>The output will be 2, when you were expecting 3! To find the error, if you didn&#8217;t notice it, read the third line very slowly TheFirstVariable is spelled differently as <em>TehFirstVariable</em>&#8211; therefore creating a new variable with a default value of zero. (or empty if used as a string)</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-option-explicit-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
