<p>As already noted by @Benjammin' in the comments, the <code>or</code> operator has to be lowercase. See <a href="http://twig.sensiolabs.org/doc/templates.html#logic" rel="nofollow">Logic Expressions</a> in the Twig docs:</p>

<blockquote>
  <p>Operators are case sensitive.</p>
</blockquote>

<p>You also have to get the dropdown value explicitly by accessing its <code>value</code> property.</p>

<pre><code>{% if block.wellFormattedContent.value == 'toBeActioned' or block.wellFormattedContent.value == 'partiallyActioned' %}
</code></pre>

<p>The short syntax <code>{{ block.wellFormattedContent }}</code> (which internally uses the field's <code>toString()</code> magic method) causes problems within Twig conditionals. You can probably also get around this issue by wrapping it in curly braces.</p>

<pre><code>{% if (block.wellFormattedContent) == 'toBeActioned' or (block.wellFormattedContent) == 'partiallyActioned' %}
</code></pre>

CC BY-SA 3.0
2016-01-20T11:43:55.017Z
Thanks Carl (again)  :D  - Should also note Benjammin point that the OR should be lowercase.
Martin
CC BY-SA 3.0
2016-01-20T12:33:59.353Z
Good to know, I thought it doesn't matter. Thanks @Martin and @Benjammin!
carlcs
CC BY-SA 3.0
2016-01-20T11:17:47.310Z
2016-01-20T12:39:27.933Z
2016-01-20T12:39:27.933Z
carlcs
<p>I have a dropdown Matrix block and need to check whether a selected value is either one or another.  If either value is selected I want to display some text on the front end.  At the moment I have <code>{% if block.wellFormattedContent =='toBeActioned' OR block.wellFormattedContent =='partiallyActioned' %}</code> but it errors.  Hopefully you can see what i'm trying to do.</p>

<p>Thanks</p>

<p>Martin</p>

CC BY-SA 3.0
2016-01-20T10:59:56.363Z
Try `or` in lowercase. You can learn more about the templating language here http://twig.sensiolabs.org/documentation
Ben Fleming
CC BY-SA 3.0
2016-01-20T11:02:55.053Z
Also, if you haven't done so already, turn on dev mode in your config file (add the line `'devMode' => true,`), it'll give you much more descriptive errors making debugging so much easier!
Ben Fleming
<matrix><conditional>
Correct syntax for an OR conditional within a Matrix block
# Correct syntax for an OR conditional within a Matrix block

(Asked by: username_0 on 2016-01-20)

I have a dropdown Matrix block and need to check whether a selected value is either one or another. If either value is selected I want to display some text on the front end. At the moment I have `{% if block.wellFormattedContent =='toBeActioned' OR block.wellFormattedContent =='partiallyActioned' %}` but it errors. Hopefully you can see what i'm trying to do.

Thanks

Martin

**Tags:** matrix, conditional
> **Comments:**
> **username_1**: Try `or` in lowercase. You can learn more about the templating language here http://twig.sensiolabs.org/documentation  
> **username_1**: Also, if you haven't done so already, turn on dev mode in your config file (add the line `'devMode' => true,`), it'll give you much more descriptive errors making debugging so much easier!  

---

## 1 answers

### Answer by username_2 on 2016-01-20. Score: 2 | Accepted answer

As already noted by @Benjammin' in the comments, the or operator has to be lowercase. See Logic Expressions in the Twig docs:

Operators are case sensitive.

You also have to get the dropdown value explicitly by accessing its value property.
{% if block.wellFormattedContent.value == 'toBeActioned' or block.wellFormattedContent.value == 'partiallyActioned' %}

The short syntax {{ block.wellFormattedContent }} (which internally uses the field's toString() magic method) causes problems within Twig conditionals. You can probably also get around this issue by wrapping it in curly braces.
{% if (block.wellFormattedContent) == 'toBeActioned' or (block.wellFormattedContent) == 'partiallyActioned' %}

> **Comments:**
> **username_0**: Thanks Carl (again)  :D  - Should also note Benjammin point that the OR should be lowercase.  
> **username_2**: Good to know, I thought it doesn't matter. Thanks @Martin and @Benjammin!  

---

