<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[scope of loop variables]]></title><description><![CDATA[<p dir="auto">What is better:<br />
for (var i = 0; i &lt; 200; i++){<br />
or<br />
for (i = 0; i &lt; 200; i++){<br />
and why i cant use:<br />
for (local i = 0; i &lt; 200; i++){</p>
<p dir="auto">What is the scope of "i" on that bucles?<br />
Thanks</p>
]]></description><link>https://forum.hise.audio/topic/622/scope-of-loop-variables</link><generator>RSS for Node</generator><lastBuildDate>Sun, 09 Aug 2026 19:29:41 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/622.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 20 Mar 2018 18:34:44 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to scope of loop variables on Wed, 21 Mar 2018 09:49:51 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.hise.audio/uid/1">@christoph-hart</a> thanks a lot</p>
]]></description><link>https://forum.hise.audio/post/3921</link><guid isPermaLink="true">https://forum.hise.audio/post/3921</guid><dc:creator><![CDATA[CherryAnt]]></dc:creator><pubDate>Wed, 21 Mar 2018 09:49:51 GMT</pubDate></item><item><title><![CDATA[Reply to scope of loop variables on Wed, 21 Mar 2018 08:20:38 GMT]]></title><description><![CDATA[<p dir="auto">I think I am following standard Javascript behaviour here which makes the scope global. There‘s no difference between <code>for(i=0</code> and <code>for(var i=0</code>), in fact this is the only case where I allowed the parser to accept unqualified assignments of variables.</p>
<p dir="auto">My recommendation is to define one <code>reg</code> variable called i in the onInit callback and reuse it (that‘s what I am doing when I need to iterate using this loop). Bear in mind that the other for loop we discussed yesterday is much more faster and should be preferred if possible.</p>
]]></description><link>https://forum.hise.audio/post/3920</link><guid isPermaLink="true">https://forum.hise.audio/post/3920</guid><dc:creator><![CDATA[Christoph Hart]]></dc:creator><pubDate>Wed, 21 Mar 2018 08:20:38 GMT</pubDate></item></channel></rss>