Help with test of a list of numbers

What about moving the if inline with the for, then using loop variables:

{%- if _rgbl is list and _rgbl | count == 3  %}
{%- for clr in _rgbl if is_number(clr) and int(clr,0) == clr and 0 <= clr <= 255 %}
{% if loop.last %}
{{ loop.index == 3 }}
{%- endif %}{% endfor%}{%- endif %}
1 Like