Limit the for loop returns with an if statement I've got a for loop working perfect with a limit of 5. Then I throw in the if statement to filter those entries that correspond with a global variable I have set. The problem is the if statement is after the for loop with the limit and only doing it's thing to the 5 entries and not all of the entries.\

I want to use the if statement on all the entries to return the ones I want, then limit it to 5. In another DIV I have and offset(5), so the rest go there. I hope that makes sense.

{% for entry in craft.entries.section('news').order('articleOrder desc').limit(5).find() %}

    {% if entry.currentYear2 == currentEdition.currentYear2 and currentEdition.currentMonth2 in entry.currentMonth2 %}

        &lt;h2&gt;{{ entry.title }}&lt;/h2&gt;

        &lt;p&gt;{{ entry.body }}&lt;/p&gt;

    {% endif %}

{% endfor %}
If I'm following you correct, you can use a conditional in a for loop to do what you want.

So in your case, it would be something like:

{% for entry in craft.entries.section('news').order('articleOrder desc').limit(5).find() if entry.currentYear2 == currentEdition.currentYear2 and currentEdition.currentMonth2 in entry.currentMonth2 %}
   ...
{% endfor %}