Lava Example - 61 | Rock Community

Lava Example - 72


Prompt

When we showed the Decker family allergies, only Alex had one. So our list was accurate. But it was kind of empty-looking since the others didn't have anything after their name.

Make your template show (none) if they don't have any allergies.

Initial Code
<h3>Decker family allergies:</h3>
<ol>
    {% person where:'LastName == "Decker"' %}
        {% for person in personItems %}
            <li>{{ person.FullName }}: {{ person | Attribute:'Allergy' }}</li>
        {% endfor %}
    {% endperson %}
</ol>
Solution Lava
<h3>Decker family allergies:</h3>
<ol>
    {% person where:'LastName == "Decker"' %}
        {% for person in personItems %}
            <li>{{ person.FullName }}: {{ person | Attribute:'Allergy' | Default:'(none)' }}</li>
        {% endfor %}
    {% endperson %}
</ol>