[SOLVED] Alternate display on odd and even with range

Hi! I currently have a code snippet that lists out a preview of a load of recommended travel experience pages:

		<h3 id="experiences">Recommended Experiences</h3>
		{{ range where .Data.Pages.ByWeight "Section" "experiences" }}
		<a class="experiences-link" href="{{ .Permalink }}" target="_blank">
			<div class="experiences-section">
				<h4>{{ .Title }}</h4>
				<h5>{{ .Params.Summary }} - {{ .Params.Duration }}</h5>
			</div>
		</a>
		{{ end }}

That all works great. But now I want to add an image to each. For even numbered ones (first one will be 0, so first is 0, 3rd is 2 and so on) I want the image to the right, text to the left. And for odd numbers, the other way round.

I found this topic
I assume I could modify the suggestion there to the following:
{{ $index, $element := range (where .Data.Pages.ByWeight "Section" "experiences") }}

Is there an easy way to check if $index is odd or even?

See here

The snippet in that post checks for odd posts in a range, you can also modify it easily to check for even posts.

Brilliant thank you! Just gave it a whirl outputting some text and looks like it should work perfectly.