# Test for property = NIL

**URL:** <https://forum.xojo.com/t/test-for-property-nil/16677>\
**Category:** General\
**Created:** [May 21, 2014, 11:12am UTC](https://forum.xojo.com/t/test-for-property-nil/16677 "2014-05-21T11:12:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexander\_van\_der\_Linden](https://forum.xojo.com/user_avatar/forum.xojo.com/alexander_van_der_linden/32/323_2.png) [@Alexander\_van\_der\_Linden](https://forum.xojo.com/u/Alexander_van_der_Linden)\
**Post date:** [May 21, 2014, 11:12am UTC](https://forum.xojo.com/t/test-for-property-nil/16677/1 "2014-05-21T11:12:43Z")

</div>

How to test for a property = NIL? I have a global App property “DB” as SQlitedatabase. DB is empty when program starts and I want to know if it is empty further along the way. How can I test that app.db = nil or app.db.name = “”? I tried both ways but NilObjectExeption…

---

<div class="post-metadata">

**Author:** ![David\_Cox](https://forum.xojo.com/user_avatar/forum.xojo.com/david_cox/32/227_2.png) [@David\_Cox](https://forum.xojo.com/u/David_Cox)\
**Post date:** [May 21, 2014, 12:21pm UTC](https://forum.xojo.com/t/test-for-property-nil/16677/2 "2014-05-21T12:21:41Z")

</div>

On Open set:

```auto
app.db = New SQLiteDatabase
```

---

<div class="post-metadata">

**Author:** ![Alexander\_van\_der\_Linden](https://forum.xojo.com/user_avatar/forum.xojo.com/alexander_van_der_linden/32/323_2.png) [@Alexander\_van\_der\_Linden](https://forum.xojo.com/u/Alexander_van_der_Linden)\
**Post date:** [May 21, 2014, 12:41pm UTC](https://forum.xojo.com/t/test-for-property-nil/16677/3 "2014-05-21T12:41:13Z")

</div>

Hi,  
You mean:  
IF app.db = new Sqlitedatabase?

---

<div class="post-metadata">

**Author:** ![Michael\_Hußmann](https://forum.xojo.com/user_avatar/forum.xojo.com/michael_hu%C3%9Fmann/32/438_2.png) [@Michael\_Hußmann](https://forum.xojo.com/u/Michael_Hu%C3%9Fmann)\
**Post date:** [May 21, 2014, 12:45pm UTC](https://forum.xojo.com/t/test-for-property-nil/16677/4 "2014-05-21T12:45:41Z")

</div>

There shouldnt be any issues testing for nil, i.e. both

[code]if App.DB = nil then

end if[/code]

and

[code]if App.DB is nil then

end if[/code]

would work. There is no NilObjectException raised as long as you are not actually trying to use the nil value as if it was an object.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:14pm UTC](https://forum.xojo.com/t/test-for-property-nil/16677/5 "2020-10-29T17:14:09Z")

</div>


