# Question about variables in gateway scripts

**URL:** <https://forum.inductiveautomation.com/t/question-about-variables-in-gateway-scripts/4276>\
**Category:** Ignition\
**Created:** [April 11, 2012, 3:08pm UTC](https://forum.inductiveautomation.com/t/question-about-variables-in-gateway-scripts/4276 "2012-04-11T15:08:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [April 11, 2012, 3:08pm UTC](https://forum.inductiveautomation.com/t/question-about-variables-in-gateway-scripts/4276/1 "2012-04-11T15:08:12Z")

</div>

Hey all,

Are gateway script variables persistent? Or, to say it another way, if I run a gateway timer script with a variable that increments would that value stay the next time the script runs or would it be reinitialized back to 0 or null?

Would it be better to write the value to a memory tag and then read that value at the beginning of the script?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 11, 2012, 3:30pm UTC](https://forum.inductiveautomation.com/t/question-about-variables-in-gateway-scripts/4276/2 "2012-04-11T15:30:43Z")

</div>

Not persistent. Memory tag would work.
