<?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>Aptech &#187; Answers for "Output for each loop"</title>
	<atom:link href="http://www.aptech.com/questions/output-for-each-loop/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aptech.com</link>
	<description></description>
	<lastBuildDate>Fri, 08 Feb 2013 19:12:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.1</generator>
		<item>
		<title>By: aptech</title>
		<link>http://www.aptech.com/questions/output-for-each-loop/#answer-2231</link>
		<comments>http://www.aptech.com/questions/output-for-each-loop/#answer-2231#comments</comments>
		<pubDate>Tue, 23 Oct 2012 14:03:11 +0000</pubDate>
		<dc:creator>aptech</dc:creator>
		
		<guid isPermaLink="false">http://www.aptech.com/questions/output-for-each-loop/#answer-2231</guid>
		<description><![CDATA[If the loops are not nested, you send the output to different files with this code: //reset will cause any existing file to be //overwritten with new contents output file=loop1.out reset; for i(1, 10, 1); print "loop 1 iteration " &#8230; <a href="http://www.aptech.com/questions/output-for-each-loop/#answer-2231">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If the loops are not nested, you send the output to different files with this code:</p>
<pre>
//reset will cause any existing file to be 
//overwritten with new contents
output file=loop1.out reset;
for i(1, 10, 1);
   print "loop 1 iteration " i;
endfor;
 
output file=loop2.out reset;
for i(1, 10, 1);
   print "loop 2 iteration " i;
endfor;

output off;
</pre>
<p>If the loops are nested, you can do this:</p>
<pre>
//Clear out files from previous run
output file=nestloop1.out reset;
output file=nestloop2.out reset;

for i(1, 10, 1);
  output file=nestloop1.out on;
  print "loop 1 iteration " i;
  for j(10, 100, 10);
      output file=nestloop2.out on;
      print "loop 2 iteration " j;
   endfor;
endfor;

output off;
</pre>
<p>If the output statement ends with &#8216;reset&#8217;, the next print statement will overwrite an existing file with the same name. If the output statement ends with<br />
&#8216;on&#8217;, the the print statements will be added to the end of any existing file.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aptech.com/questions/output-for-each-loop/#answer-2231/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.aptech.com @ 2013-02-09 01:55:01 --