'If/else' statement inside 'nav' tag Craft CMS V2. 
Comment Plugin: verbb comment

&lt;ul&gt;
    {% nav comment in comments %}
       {% if comment.isFlagged() == false %}
          &lt;li&gt;
              {% include '_forms/templates/comment-' ~ comment.status %}
              {% include '_forms/templates/form' %}

            {% ifchildren %}
                &lt;ul class="child"&gt;
                    {% children %}
                &lt;/ul&gt;
            {% endifchildren %}
          &lt;/li&gt;
       {% endif %}
    {% endnav %}
&lt;/ul&gt;


The above code creates this error:

Unexpected "ifchildren" tag (expecting closing tag for the "if" tag)


So, How can I use if/else condition inside the nav tag to hide flagged comment including it's children.
Short answer, it can't be done. I'm not sure why, but it's some sort of conflict with how nav, children, and ifchildren operates.

The workaround is ugly (but it works). Just use two separate, but identical if statements... one before the ifchildren, and one after.

{% if comment.isFlagged() == false %}
    ...
{% endif %}
{% ifchildren %}
    ...
{% endifchildren %}
{% if comment.isFlagged() == false %}
    ...
{% endif %}


EDIT:

If this solution doesn't work for you, I recommend looping over the comments array and removing all flagged comments before you run it through the nav loop.