I have the following snippet of code:

      <table>
      {% for r in result %}
        <tr>
          {% set debit = zero %}
        </tr>
        <tr>
        {% for t in r.transactions %}
            {% set amount = t.amount[0] %}
            {% if amount > 0 %}
              {% set debit = debit + amount %}
              <td>{{ debit }}</td>
            {% endif %}
        {% endfor %}
        </tr>
        <tr>
          <td>{{ debit }}</td>
        </tr>
      {% endfor %}
      </table>

The value for amount is 300.00 and 500.00 for the first iteration of the 
outer loop.

My first lines of output look like this:

300.00 800.00
0.00

The first line contains the value of debit inside the loop. Everything is 
fine and dandy.
The second line contains the value of debit after the inner loop has 
completed. It should be saying 800.00, but it says 0.00. For some reason 
the value of debit inside the loop has gone out of scope and we have 
reverted to the initial value of debit. This is the behaviour I would 
expect of a with.statement, but not from a for-loop.

Jacob Hallén
 

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pocoo-libs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to