Within a template, the index is available using #index
There is an {{if}}
construct that can be used to alternate between two choices.
The untested code would be something like:
{{if #index % 2 }}
code for odd case
{{else}}
code for even case
{{/if}}
Do a view source of this to see a simple use of #index.
Do a view source of this to see a simple use of if, then, else.