# Testing “if” against multiple segments

Got myself into a seemingly simple dead-end block with twig syntax. I need to test against multiple items:

{% set segment1 = craft.request.firstSegment %}
{% if segment1 == 'one OR two OR three' %}
DO SOMETHING
{% endif %}


What's going wrong with this bit 'one OR two OR three'? brackets?

You've just got quotes wrapped around a simple string. Try something like this instead...

{% if segment1 in ['one','two','three'] %}


That will check to see if your segment1 value is in the array of possible matches.

• Super thanks. I got caught out by the "in"! – Simon Clayson Oct 8 '14 at 9:40