Checking if related entries are live in a for loop and setting a variable based on the results
You're looking for the filter filter: https://docs.craftcms.com/v3/dev/filters.html#filter
Specifically something like this (untested):
{% set activeChildren = children|filter(child =&gt; child.associatedTerm|length) %}
{% set inactiveChildren = children|filter(child =&gt; child.associatedTerm|length == 0) %}

You now have two unique arrays to do with as you please:
{% if activeChildren|length %}
   &lt;h2&gt;You have active children&lt;/h2&gt;
{% endif %}
&lt;p class=&quot;{{ inactiveChildren|length ? 'inactiveChildren' }}&quot;&gt;Hi there&lt;/p&gt;

Whenever you get the sneaky feeling that a loop is overkill, look to map filter and reduce: these 3 methods are all like loops in disguise, in that they iterate through arrays and return something new based on the logic you supply.