(Flask) How to make an If statement in html that detects the last item in a for loop

Solution
{% for post in posts %}

{{ post.title }}

{{ post.subtitle }}

{% if loop.last %}
{% else %}
{% endif %} {% endfor %}