title: Increment integer in ant-contrib
body: <p>I need some help with ant. I have a target where I loop over a fileset using foreach from ant-contrib. I call another target(lets call it doStuff) for each of iteration of the loop.</p>
  
  <p>The output of doStuff is something that I would like to store in a file. I would like the files to have unique names and I thought that an integer that gets incremented with every loop would suit me well.</p>
  
  <p>I tried many variations of the code below and had no success. I have probably not understod and yet. It seems to work with immutable properties, making the targets stateless. While I do enjoy that, it doesn't help me with my current problem.</p>
  
  <p>Is there any way to set the myInt in the first target and keep the 'state', increment it with every loop and pass it on to the next target?</p>
  
  <pre><code>&lt;var name="myInt"  unset="true"/&gt;
  
  &lt;var name="myInt" value="0"/&gt;
  
  &lt;target name="default"&gt;
      &lt;foreach target="doStuff" param="theFile"&gt;
          &lt;fileset dir="" casesensitive="yes"&gt;
              &lt;depth max="0"/&gt;
          &lt;/fileset&gt;
      &lt;/foreach&gt;
  &lt;/target&gt;
  
  &lt;target name="doStuff"  description="Make output directories and run the MXUnit task"&gt;
      &lt;var name="op1" value="${myInt}"/&gt;
      &lt;var name="op2" value="1"/&gt;
      &lt;var name="op" value="+"/&gt;
      &lt;math result="result" operand1="${op1}" operation="${op}" operand2="${op2}" datatype="int"/&gt;
      &lt;var name="myInt" unset="true"/&gt;
      &lt;var name="myInt" value="${result}"/&gt;  
  &lt;!-- Here I save the file with the name ${result}--&gt;
  &lt;/target&gt;
  </code></pre>