# question in when & with\_nested loops

**URL:** <https://forum.ansible.com/t/question-in-when-with-nested-loops/18978>\
**Category:** Ansible Project\
**Created:** [August 10, 2015, 6:25am UTC](https://forum.ansible.com/t/question-in-when-with-nested-loops/18978 "2015-08-10T06:25:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![user27](https://avatars.discourse-cdn.com/v4/letter/u/a183cd/32.png) [@user27](https://forum.ansible.com/u/user27)\
**Post date:** [August 10, 2015, 6:25am UTC](https://forum.ansible.com/t/question-in-when-with-nested-loops/18978/1 "2015-08-10T06:25:38Z")

</div>

when item[0] in item[1]  
with\_nested:

- [1,2]
- [1,3]

will make all loop,just like:(1 in 1)? and then also do (1 in 3)?..,but how to let it not do the (1 in 3)?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [August 10, 2015, 1:13pm UTC](https://forum.ansible.com/t/question-in-when-with-nested-loops/18978/2 "2015-08-10T13:13:07Z")

</div>

i'm not sure, but I think you want:

when: item[0] == item[1]
