How to do a simple for loop in Antlers

I want to display simple SVG stars representing the review. E.g. 4 yellow stars and 1 gray star to show a 4/5 review. The start rating (an integer) is stored in a collection.

How can I do a for loop in Antlers? In the docs I only see a foreach loop. When I do it via raw php, I am not able to access the values from a collection. A simplified version of my problem:

{{ collection:reviews type:is="facebook" sort="random" limit="1" }}
    <?php for ($i = 0; $i < [I don't know how to access $rating field here]; $i++) {?>
    <?php } ?>
{{ /collection:reviews }}
>>>>>>> Unanswered <<<<<<<
10 Replies