# \[Solved\] Important Question About Variable

**URL:** <https://community.thunkable.com/t/solved-important-question-about-variable/130975>\
**Category:** Questions about Thunkable X\
**Tags:** solved\
**Created:** [July 4, 2019, 12:12am UTC](https://community.thunkable.com/t/solved-important-question-about-variable/130975 "2019-07-04T00:12:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![abedo](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/abedo/32/6468_2.png) [@abedo](https://community.thunkable.com/u/abedo)\
**Post date:** [July 4, 2019, 12:12am UTC](https://community.thunkable.com/t/solved-important-question-about-variable/130975/1 "2019-07-04T00:12:22Z")

</div>

Hello  
I need to know if i understood “Variables” well

Know when i am coding, i initialize variable “Score” = 0  
User will start the game and his new score in 17  
now, which way i should use  
Way one: App sets variable “Score”=17 and Local Storage key “Score”=17 and when user uses the app again app will call Local Storage Key and sets the variable “Score” to the local storage value.

or

Way two: when game finishes, app sets variable “Score” = 17 only

MY QUESTION:  
in case of using 2nd way, when the user opens the app again, will variable value be 17 or it will be 0 and i have to call Local Storage?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [July 4, 2019, 2:12am UTC](https://community.thunkable.com/t/solved-important-question-about-variable/130975/2 "2019-07-04T02:12:04Z")

</div>

You need to use local storage.  
The current value of a variable is maintained as long as the app is running. Next time the app will be started, all the initialization will run anew, so the score would start from 0 again.

---

<div class="post-metadata">

**Author:** ![Abdelrahman1](https://avatars.discourse-cdn.com/v4/letter/a/5daacb/32.png) [@Abdelrahman1](https://community.thunkable.com/u/Abdelrahman1)\
**Post date:** [July 4, 2019, 12:34pm UTC](https://community.thunkable.com/t/solved-important-question-about-variable/130975/3 "2019-07-04T12:34:37Z")

</div>

Even stored variables ? @CBVG

---

<div class="post-metadata">

**Author:** ![CBVG](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/cbvg/32/32401_2.png) [@CBVG](https://community.thunkable.com/u/CBVG)\
**Post date:** [July 4, 2019, 5:22pm UTC](https://community.thunkable.com/t/solved-important-question-about-variable/130975/4 "2019-07-04T17:22:31Z")

</div>

No, not stored variable; those are kept.  
This is precisely what this is about.

---

<div class="post-metadata">

**Author:** ![jane](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/jane/32/27575_2.png) [@jane](https://community.thunkable.com/u/jane)\
**Post date:** [July 4, 2019, 7:38pm UTC](https://community.thunkable.com/t/solved-important-question-about-variable/130975/5 "2019-07-04T19:38:24Z")

</div>

Hi there,

If you use an app variable, it will reset every time the app is closed and re-opened.  
If you use a stored variable, it will be stored and recalled even if the app has been closed and re-opened.  
Stored variables work just like the Local Storage component, except they are easier to work with!

Have you checked out the docs about [variables](https://docs.thunkable.com/variables)?

---

<div class="post-metadata">

**Author:** ![abedo](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/abedo/32/6468_2.png) [@abedo](https://community.thunkable.com/u/abedo)\
**Post date:** [July 4, 2019, 9:31pm UTC](https://community.thunkable.com/t/solved-important-question-about-variable/130975/6 "2019-07-04T21:31:32Z")

</div>

Yes i have checked it but i just wanted to ensure that before i start replacing “Local Storage” by “Stored Variable”

Thanks a lot

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 12:12pm UTC](https://community.thunkable.com/t/solved-important-question-about-variable/130975/7 "2024-11-08T12:12:22Z")

</div>


