Set dynamic class in for Loop
I can't comment yet to reply directly to Mats Mikkel Rummelhoff's comment above, but just in case someone comes across this and is looking to alternate styles instead of basing it on the loop.index count.

You would do so using the Twig odd or even tests

{{ loop.index is odd ? 'odd' : 'even' }}


or

{{ loop.index is even ? 'even' : 'odd' }}


There is no loop.odd key