title: Setting variable in Jinja for loop doesn't persist between iterations
body: <p>I want to loop over a list of objects and count how many objects meet a requirement. I based my code off other examples I'd found, but it doesn't work, the count is always 0 after the loop.</p>
  
  <p>For each house, I want to loop over each room and count how many rooms have a bed. I want to output that then reset the count for the next house.</p>
  
  <pre><code>{% for house in city %}
  {% set count = 0 %}
      &lt;div&gt;{{ house.address }} has {{ count }} beds in it rooms.&lt;/div&gt;
      {% for room in house %}
      {% if room.has_bed == True %}{% set count = count + 1 %}{% endif %}
     {% endfor %}
  {% endfor %}
  </code></pre>