<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: For-Loop doesn't respect arguments...? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/For-Loop-doesn-t-respect-arguments/m-p/362141#M61182</link>
    <description>&lt;P&gt;Ouch! This is quite embarrassing. It's seems I couldn't find the forest because of all the trees around me...!&lt;/P&gt;&lt;P&gt;Thanks nevertheless. Tells me that I've become rusty with my scripting routine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Kofi&lt;/P&gt;</description>
    <pubDate>Wed, 24 Feb 2021 11:33:43 GMT</pubDate>
    <dc:creator>Monomorphist</dc:creator>
    <dc:date>2021-02-24T11:33:43Z</dc:date>
    <item>
      <title>For-Loop doesn't respect arguments...?</title>
      <link>https://community.jmp.com/t5/Discussions/For-Loop-doesn-t-respect-arguments/m-p/360836#M61038</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can anybody explain why my for-loop below does not start with i=4 and does not end after i&amp;gt;250?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For ( i = 4 , i= i+12, i &amp;lt; 250, 
	.....
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The loop does as required and gives me correct results for i=16,28,40 etc etc. Only --- I don't get results for i=4. First results come for i=16. And the loop never ends. The script crashes when i reaches a value beyond my data limits (somewhere around 1800). I've written plenty of loops by now, but never had this issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Kofi&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 22:06:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Loop-doesn-t-respect-arguments/m-p/360836#M61038</guid>
      <dc:creator>Monomorphist</dc:creator>
      <dc:date>2023-06-09T22:06:28Z</dc:date>
    </item>
    <item>
      <title>Re: For-Loop doesn't respect arguments...?</title>
      <link>https://community.jmp.com/t5/Discussions/For-Loop-doesn-t-respect-arguments/m-p/360855#M61042</link>
      <description>&lt;P&gt;Please open Help --&amp;gt; Scripting index, search for "for" and find the enclosed example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You see, that arguments need different order.&lt;/P&gt;&lt;P&gt;Also when hover over the command "for" you see the syntax, JMP expects.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );
s = "";
For( i = 1, i &amp;lt; 10, i++,
	s ||= " " || Char( i )
);
Trim( s );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2021 18:20:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Loop-doesn-t-respect-arguments/m-p/360855#M61042</guid>
      <dc:creator>Georg</dc:creator>
      <dc:date>2021-02-19T18:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: For-Loop doesn't respect arguments...?</title>
      <link>https://community.jmp.com/t5/Discussions/For-Loop-doesn-t-respect-arguments/m-p/360858#M61043</link>
      <description>&lt;P&gt;I think your second and third arguments are switched, maybe try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt; For ( i = 4 , i &amp;lt; 250, i = i+12, 
	...
 )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that doesn't work, you might check whether your iterator variable is used in the loop.&amp;nbsp; You can ensure this is&amp;nbsp;&lt;EM&gt;not&lt;/EM&gt; a problem be adding a local context for that variable, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;For ( i = 4 , i &amp;lt; 250, i= i+12, 
	write( "Starting iteration " || char(i) || "\!n");
	local( {i},
		...&lt;BR /&gt;		i = 1&lt;BR /&gt;		...
	)
 )
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 21 Feb 2021 03:13:36 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Loop-doesn-t-respect-arguments/m-p/360858#M61043</guid>
      <dc:creator>ih</dc:creator>
      <dc:date>2021-02-21T03:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: For-Loop doesn't respect arguments...?</title>
      <link>https://community.jmp.com/t5/Discussions/For-Loop-doesn-t-respect-arguments/m-p/362141#M61182</link>
      <description>&lt;P&gt;Ouch! This is quite embarrassing. It's seems I couldn't find the forest because of all the trees around me...!&lt;/P&gt;&lt;P&gt;Thanks nevertheless. Tells me that I've become rusty with my scripting routine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Kofi&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 11:33:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/For-Loop-doesn-t-respect-arguments/m-p/362141#M61182</guid>
      <dc:creator>Monomorphist</dc:creator>
      <dc:date>2021-02-24T11:33:43Z</dc:date>
    </item>
  </channel>
</rss>

