 




<?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; for each next</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/tag/for-each-next/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 For Each &#8230; Next Statement</title>
		<link>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-for-each-next-statement/</link>
		<comments>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-for-each-next-statement/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 00:06:14 +0000</pubDate>
		<dc:creator>Jerry Lees</dc:creator>
				<category><![CDATA[Conditional statements]]></category>
		<category><![CDATA[for]]></category>
		<category><![CDATA[for each]]></category>
		<category><![CDATA[for each next]]></category>
		<category><![CDATA[next]]></category>
		<category><![CDATA[VBScript Statements]]></category>
		<category><![CDATA[vbscriptstatements]]></category>
		<category><![CDATA[working with arrays]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-for-each-next-statement/</guid>
		<description><![CDATA[The For Each Next statement combination is very useful for situations where you need to loop through a piece of code a specific number of times, just like the For Next statement, except that you may not even know at run time how many items you need to loop through.  This particular variation of the [...]]]></description>
				<content:encoded><![CDATA[<p><font size="2" face="Arial">The <strong>For Each Next </strong>statement combination is very useful for situations where you need to loop through a piece of code a specific number of times, just like the <strong>For Next</strong> statement, except that you may not even know at run time how many items you need to loop through. </font></p>
<p><font size="2" face="Arial">This particular variation of the <strong>For Next</strong> statement is particularly helpful when iterating through arrays, objects, or collections&#8211; cases where you may not know how many items are in the object or collection with out going through them first. (Which would be a waste of resources)<br />
 <br />
You can use <strong>Exit For</strong> statements to exit out of a <strong>For Each Next</strong> loop, if you need to check for a condition inside the loop. </font></p>
<p><font size="2" face="Arial">Here is an example of a <strong>For Each Next</strong> statement:</font></p>
<p><font size="2" color="#0000ff" face="Arial">ReDim Collection(2)<br />
Collection(0) = &#8220;Test&#8221;<br />
Collection(1) = &#8220;Test 2&#8243;<br />
Collection(2) = &#8220;Test 3&#8243;</font></p>
<p><font size="2" color="#0000ff" face="Arial">For Each Item in Collection<br />
</font><font size="2" color="#0000ff" face="Arial">     wscript.echo item<br />
next</font></p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/vbscript-systems-administrator/vbscript-statements-explanation-of-the-for-each-next-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
