Skip to content

Instantly share code, notes, and snippets.

@hydra1983
Last active December 18, 2015 17:49
Show Gist options
  • Save hydra1983/5820910 to your computer and use it in GitHub Desktop.
Save hydra1983/5820910 to your computer and use it in GitHub Desktop.
Counter for iteration a list in for task based on math task of ant-contrib
<var name="counter" value="0"/>
<for list="{list}" param="{param}">
<sequential>
<switch value="${counter}">
<case value="0">
<!-- do something -->
</case>
<case value="1">
<!-- do something -->
</case>
<!-- other cases -->
</switch>
<!-- increase the counter -->
<math result="counter"
operand1="${counter}"
operation="+"
operand2="1"
datatype="int"/>
</sequential>
</for>
<var name="counter" unset="true"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment