# Evaluation precedence in conditional expressions

**URL:** <https://forum.ansible.com/t/evaluation-precedence-in-conditional-expressions/30732>\
**Category:** Ansible Project\
**Created:** [July 9, 2019, 1:33pm UTC](https://forum.ansible.com/t/evaluation-precedence-in-conditional-expressions/30732 "2019-07-09T13:33:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucio\_Guerchi](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@Lucio\_Guerchi](https://forum.ansible.com/u/Lucio_Guerchi)\
**Post date:** [July 9, 2019, 1:33pm UTC](https://forum.ansible.com/t/evaluation-precedence-in-conditional-expressions/30732/1 "2019-07-09T13:33:21Z")

</div>

I am new to Ansible and have the following questions, if I have the following conditional, what is going to be parsed first, the filter or the not, were foo is a boolean variable True or False?

when: not foo | bool

Are the following expressions the same?

when: not foo | bool

is the same as

when: not (foo | bool)

---

<div class="post-metadata">

**Author:** ![shivharsh.nec](https://avatars.discourse-cdn.com/v4/letter/s/f05b48/32.png) [@shivharsh.nec](https://forum.ansible.com/u/shivharsh.nec)\
**Post date:** [July 10, 2019, 11:36am UTC](https://forum.ansible.com/t/evaluation-precedence-in-conditional-expressions/30732/2 "2019-07-10T11:36:59Z")

</div>

Hi Lucio,

The filter would be evaluated first and then the not.

Consider below playbook :

`

---

<div class="post-metadata">

**Author:** ![Lucio\_Guerchi](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@Lucio\_Guerchi](https://forum.ansible.com/u/Lucio_Guerchi)\
**Post date:** [July 11, 2019, 1:35pm UTC](https://forum.ansible.com/t/evaluation-precedence-in-conditional-expressions/30732/3 "2019-07-11T13:35:58Z")

</div>

Thanks Shivharsh Singh 🙂
