<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Flexible Loop Syntax</title>
	<atom:link href="http://jacksondunstan.com/articles/203/feed" rel="self" type="application/rss+xml" />
	<link>http://jacksondunstan.com/articles/203</link>
	<description>Mastering AS3</description>
	<lastBuildDate>Tue, 07 Feb 2012 09:30:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Map</title>
		<link>http://jacksondunstan.com/articles/203/comment-page-1#comment-383</link>
		<dc:creator>Map</dc:creator>
		<pubDate>Thu, 12 Nov 2009 04:36:33 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=203#comment-383</guid>
		<description>Oh, The code in comment #2 works for me in Flash CS3. The error it throws (if compile in Flash IDE) is not related to the strange loop syntax.</description>
		<content:encoded><![CDATA[<p>Oh, The code in comment #2 works for me in Flash CS3. The error it throws (if compile in Flash IDE) is not related to the strange loop syntax.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alec McEachran</title>
		<link>http://jacksondunstan.com/articles/203/comment-page-1#comment-358</link>
		<dc:creator>Alec McEachran</dc:creator>
		<pubDate>Sat, 07 Nov 2009 17:21:16 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=203#comment-358</guid>
		<description>Just a couple of additional bit of information:

If you attempt to compile your test code (from comment #2 above) in Flash CS3, it does not compile.

FDT does flag it up as an error, but as you rightly point out, then the MXML compiler doesn&#039;t catch it at compile.

Weird.

Regards, Alec</description>
		<content:encoded><![CDATA[<p>Just a couple of additional bit of information:</p>
<p>If you attempt to compile your test code (from comment #2 above) in Flash CS3, it does not compile.</p>
<p>FDT does flag it up as an error, but as you rightly point out, then the MXML compiler doesn&#8217;t catch it at compile.</p>
<p>Weird.</p>
<p>Regards, Alec</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jackson</title>
		<link>http://jacksondunstan.com/articles/203/comment-page-1#comment-31</link>
		<dc:creator>jackson</dc:creator>
		<pubDate>Wed, 16 Sep 2009 20:23:57 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=203#comment-31</guid>
		<description>I hadn&#039;t thought to do that. I just tried it though:

&lt;pre lang=&quot;actionscript3&quot;&gt;
trace(&quot;before&quot;);
			
function getNames(): Array { return [&quot;name1&quot;,&quot;name2&quot;]; }
			
// assume getNames() returns an array with length 2
for each (var name:String in getNames(), [&quot;extra name&quot;])
{
	trace(name);
}
 
trace(&quot;after&quot;);
&lt;/pre&gt;

And I get:

&lt;pre lang=&quot;text&quot;&gt;
before
extra name
after
&lt;/pre&gt;

So it seems as though the comma operator is evaluating to the second argument and the loop is then iterating over that. I wonder if this is useful for anything...

Thank you for the tip!</description>
		<content:encoded><![CDATA[<p>I hadn&#8217;t thought to do that. I just tried it though:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;before&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> getNames<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span> <span style="color: #004993;">Array</span> <span style="color: #000000;">&#123;</span> <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;name1&quot;</span><span style="color: #000066; font-weight: bold;">,</span><span style="color: #990000;">&quot;name2&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000066; font-weight: bold;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// assume getNames() returns an array with length 2</span>
<span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #0033ff; font-weight: bold;">each</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">name</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> <span style="color: #0033ff; font-weight: bold;">in</span> getNames<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #000000;">&#91;</span><span style="color: #990000;">&quot;extra name&quot;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>
<span style="color: #000000;">&#123;</span>
    <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;after&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

<p>And I get:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">before
extra name
after</pre></div></div>

<p>So it seems as though the comma operator is evaluating to the second argument and the loop is then iterating over that. I wonder if this is useful for anything&#8230;</p>
<p>Thank you for the tip!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Troy Gilbert</title>
		<link>http://jacksondunstan.com/articles/203/comment-page-1#comment-25</link>
		<dc:creator>Troy Gilbert</dc:creator>
		<pubDate>Wed, 16 Sep 2009 20:10:55 +0000</pubDate>
		<guid isPermaLink="false">http://jacksondunstan.com/?p=203#comment-25</guid>
		<description>What if you tried this:

&lt;code&gt;for each (var name:String in getNames(), [&quot;extra name&quot;])&lt;/code&gt;

Both false and true don&#039;t evaluate to lists, so it doesn&#039;t surprise me that the loop gets skipped for either of those.</description>
		<content:encoded><![CDATA[<p>What if you tried this:</p>
<p><code>for each (var name:String in getNames(), ["extra name"])</code></p>
<p>Both false and true don&#8217;t evaluate to lists, so it doesn&#8217;t surprise me that the loop gets skipped for either of those.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

