<p>Twig's <code>is not null</code> should work for this.  Assuming you have a Number field called <code>number</code> and you're looping through a list of entries, something like this should work:</p>

<pre><code>{% for entry in entries if entry.number is not null %}
    {{ entry.number }}
{% endfor %}
</code></pre>

CC BY-SA 4.0
2020-01-16T00:24:21.167Z
2020-01-16T00:24:21.167Z
Brad Bell
<p>Is there a way to differentiate the number field value empty and 0? </p>

<p>I would like to display this field only when there's a value in the field even though the value is 0. </p>

<p>But when I input 0 into the field, it seems that Craft thinks the value is empty... so doesn't still display the field. </p>

<p>Thanks.</p>

CC BY-SA 4.0
2020-01-23T19:55:23.570Z
Where are you trying to display the field value? Twig has the [`empty` test](https://twig.symfony.com/doc/2.x/tests/empty.html) which may be of interest!
August Miller
<field><fieldtypes><number>
Number field when empty and value=0
# Number field when empty and value=0

(Asked by: username_0 on 2020-01-15)

Is there a way to differentiate the number field value empty and 0?

I would like to display this field only when there's a value in the field even though the value is 0.

But when I input 0 into the field, it seems that Craft thinks the value is empty... so doesn't still display the field.

Thanks.

**Tags:** field, fieldtypes, number
> **Comments:**
> **username_1**: Where are you trying to display the field value? Twig has the [`empty` test](https://twig.symfony.com/doc/2.x/tests/empty.html) which may be of interest!  

---

## 1 answers

### Answer by username_2 on 2020-01-16. Score: 1

Twig's is not null should work for this.  Assuming you have a Number field called number and you're looping through a list of entries, something like this should work:
{% for entry in entries if entry.number is not null %}
    {{ entry.number }}
{% endfor %}


---

