# App Variable not Being Set?

**URL:** <https://community.thunkable.com/t/app-variable-not-being-set/1764880>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [March 3, 2022, 7:32am UTC](https://community.thunkable.com/t/app-variable-not-being-set/1764880 "2022-03-03T07:32:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpar4](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mpar4/32/127847_2.png) [@mpar4](https://community.thunkable.com/u/mpar4)\
**Post date:** [March 3, 2022, 7:32am UTC](https://community.thunkable.com/t/app-variable-not-being-set/1764880/1 "2022-03-03T07:32:41Z")

</div>

Hello! I’m a part-time teacher trying to teach some intro-level coding concepts to high school students. I’ve become stumped with assigning values to variables. Please help.

The app is a simple encyclopedia-type application to show my students how to work with variables and event handlers, but I can’t seem to assign a new value to a variable:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/c/6c84e5fa950f5225b3f124eccdf634da2895de72.png)

The block causing issues is the “set app variable rowNumber to index”. I played around with it, and can confirm that the index is a number, but when it’s set using the “set” block it doesn’t seem to take? I’ve tried initializing the rowNumber to an number data type, but this did not change anything.

If you’d like a closer look: [Thunkable](https://x.thunkable.com/copy/8c48cbcf060fe799a99ff08c64d8800c)

Any help is appreciated. Thank you, in advance!

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [March 3, 2022, 7:40am UTC](https://community.thunkable.com/t/app-variable-not-being-set/1764880/2 "2022-03-03T07:40:24Z")

</div>

Hi and welcome to Thunkable! I teach in a K-8 school makerspace and offer an elective in app design with Thunkable.

It’s easier to use the automatically-generated variable name blocks rather than the editable name blocks. That’s kind of a mouthful so…

This:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/a/ca0ace6762e5cf21d3167dc1c22ff8f40704933f.png)

Instead of this:

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/f/cffd5a6c2ebbe99fe4ef62bb0c43fca3921275bf.png)

The reason your blocks did not work is because you were asking Thunkable to set the variable named “1” or “2” or whatever the index value is. That “name” field is for the name of a variable but you gave it a variable (not a name) and that variable happens to have a numeric value.

I’ve used Thunkable for over a year without ever using that second type of variable block. It’s not that it’s not useful in certain situations but… I rarely find a need and I definitely find it error-producing because the onus is on me to type the name correctly.

---

<div class="post-metadata">

**Author:** ![mpar4](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mpar4/32/127847_2.png) [@mpar4](https://community.thunkable.com/u/mpar4)\
**Post date:** [March 3, 2022, 7:44am UTC](https://community.thunkable.com/t/app-variable-not-being-set/1764880/3 "2022-03-03T07:44:01Z")

</div>

Thank you! I completely misunderstood that coding block.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [June 1, 2022, 7:44am UTC](https://community.thunkable.com/t/app-variable-not-being-set/1764880/4 "2022-06-01T07:44:02Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
