Twig 不能使用 OR 关键字

Twig can't use OR keyword

(嗨!) 我正在尝试执行我认为的条件,但出现以下错误:

Unexpected token "name" of value "OR" ("end of statement block" expected).

而且我不知道如何解决它,这是我的看法:

{% extends 'layout.html.twig' %}

{% block title %}Récapitulatif{% endblock %}

{% block body %}

<h1 class="propertyTitle">Récapitulatif de mes revenus</h1>

<div class="container">
    {% if years is defined OR dates is defined %} //the problem is here
        {#{% if dates is defined %}#}
            <ul class="datesList">
                {% for years in year %}
                        <li><a href="{{ path('year_resume', { 'year': years }) }}" class="date"><i class="fas fa-glass-cheers year"></i> {{ years }}</a></li>
                {% endfor %}

                <span class="resumeSpace"></span>

                {% for dates in date %}
                    <li><a href="{{ path('monthly_resume', { 'date': dates }) }}" class="date"><i class="far fa-calendar-alt dateCalendar"></i> {{ dates }}</a></li>
                {% endfor %}
            </ul>
        {#{% endif %}#}
    {% else %}
    Nous n'avons pas d'informations concernant les revenus passés.
    {% endif %}
</div>

{% endblock %}

小写 or 解决了问题。