# If statements using tags

**URL:** <https://forum.inductiveautomation.com/t/if-statements-using-tags/64057>\
**Category:** Ignition\
**Created:** [September 14, 2022, 2:58pm UTC](https://forum.inductiveautomation.com/t/if-statements-using-tags/64057 "2022-09-14T14:58:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noobarak](https://avatars.discourse-cdn.com/v4/letter/n/f4b2a3/32.png) [@Noobarak](https://forum.inductiveautomation.com/u/Noobarak)\
**Post date:** [September 14, 2022, 2:58pm UTC](https://forum.inductiveautomation.com/t/if-statements-using-tags/64057/1 "2022-09-14T14:58:03Z")

</div>

Im really new so would like some help with if with this if statement that is incorrect but not sure how it’s supposed to look like.

if system.tag.read(“tag1”).value =Null:  
system.tag.write(“tag2”).value = 1

They are both integers.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [September 14, 2022, 3:00pm UTC](https://forum.inductiveautomation.com/t/if-statements-using-tags/64057/2 "2022-09-14T15:00:21Z")

</div>

It would be like

```auto
if system.tag.readBlocking(["tag1"])[0].value is None:
    system.tag.writeBlocking(["tag2"], [1])

```

Read more here  
[https://docs.inductiveautomation.com/display/DOC80/system.tag.readBlocking](https://docs.inductiveautomation.com/display/DOC80/system.tag.readBlocking)  
and here  
[https://docs.inductiveautomation.com/display/DOC80/system.tag.writeBlocking](https://docs.inductiveautomation.com/display/DOC80/system.tag.writeBlocking)

Highly recommend taking the Inductive University courses if you have not already.

I’m also unsure under what conditions a tag will return a None though I suppose it’s possible.

---

<div class="post-metadata">

**Author:** ![ken.maze](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ken.maze/32/85876_2.png) [@ken.maze](https://forum.inductiveautomation.com/u/ken.maze)\
**Post date:** [September 14, 2022, 3:34pm UTC](https://forum.inductiveautomation.com/t/if-statements-using-tags/64057/3 "2022-09-14T15:34:48Z")

</div>

As noted above, in checking for Null Python uses is None, not unlike SQL. But if you are doing an actual equality check, make sure you are using ==, not =.

At least it doesn’t get you in as much trouble as C will if you use =, because Ignition will squiggly line it (so watch for that), C/C++ will just accept it as an assignment statement and let you tear your hair out until you notice it.
