# What's The Difference?

**URL:** <https://forum.ansible.com/t/whats-the-difference/19354>\
**Category:** Ansible Project\
**Created:** [September 25, 2015, 12:42pm UTC](https://forum.ansible.com/t/whats-the-difference/19354 "2015-09-25T12:42:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tennis\_Smith](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@Tennis\_Smith](https://forum.ansible.com/u/Tennis_Smith)\
**Post date:** [September 25, 2015, 12:42pm UTC](https://forum.ansible.com/t/whats-the-difference/19354/1 "2015-09-25T12:42:47Z")

</div>

Hi,

What’s the difference, if any, between these 2 constructs?

when: varname is none

…and…

when: varname | trim == ‘’

Are they equivalent, or is there a subtle difference?

-T

---

<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:** [September 25, 2015, 1:19pm UTC](https://forum.ansible.com/t/whats-the-difference/19354/2 "2015-09-25T13:19:56Z")

</div>

they are actually quite different.

None is a 'null' while '' is an empty string, different types. They  
both evaluate to False so they would be equivalent here:

when: varname

but not in the specific tests you show, if varname is None, it would  
error out in the 2nd test and the empty string would not match in the  
first case.

---

<div class="post-metadata">

**Author:** ![Tennis\_Smith](https://avatars.discourse-cdn.com/v4/letter/t/f05b48/32.png) [@Tennis\_Smith](https://forum.ansible.com/u/Tennis_Smith)\
**Post date:** [September 25, 2015, 1:46pm UTC](https://forum.ansible.com/t/whats-the-difference/19354/3 "2015-09-25T13:46:30Z")

</div>

Thanks, Brian!

So, “when: varname” is equivalent to both of my examples?

-T

---

<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:** [September 25, 2015, 1:49pm UTC](https://forum.ansible.com/t/whats-the-difference/19354/4 "2015-09-25T13:49:07Z")

</div>

not exactly, it will be false for the values of None and '' but not for ' '
