title: Twig compare two values in different arrays
body: <p>First of all I'm learning Twig. 
  I was wondering if it is possible wit Twig to compare two different values from different arrays/lists?!</p>
  
  <p>I have two list of items I call them like so:</p>
  
  <pre><code>{% if page.cart %}
  {% for product in page.cart.products %}
    {{ product.id }}
  {% endfor %}
  {% endif %}
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>{% if products %}
  {% for product in products %}
    {{ product.id }}
  {% endfor %}
  {% endif %}
  </code></pre>
  
  <p>I want to compare both <code>product.id</code>'s so I can create a new statement. Is there any way to compare both values? The idea is to check if an id is present in <code>page.cart.products</code> and if so then do something.</p>
  
  <p>I want to create a new statement to display some info. Something like so:</p>
  
  <pre><code>{% if page.cart %}
  {% for product in page.cart.products %}
    {% set cartId %}{{ product.id }}{% endset %}
  {% endfor %}
  {% endif %}
  
  {% if products %}
  {% for product in products %}
    {% set listId %}{{ product.id }}{% endset %}
  {% endfor %}
  {% endif %}
  
  {% if cartId == listId %}
  .... do this ....
  {% endif %} 
  </code></pre>
  
  <p>Any help greatly appreciated!</p>