# Variable not incrementing

**URL:** https://community.thunkable.com/t/variable-not-incrementing/1331139
**Category:** Questions about Thunkable X
**Created:** [June 7, 2021, 4:21pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139 "2021-06-07T16:21:04Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![meer51](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/meer51/32/95070_2.png) [@meer51](https://community.thunkable.com/u/meer51)
#### Post date: [June 7, 2021, 4:21pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/1 "2021-06-07T16:21:05Z")

</div>

I am new to this and building an app to ask a 10 questions and award ten point for a correct answer. The question number is incrementing fine but the variable score remains zero. I

 ![score-screen](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/3/43e21cc1a1eac821814495629fbedb0388b95017.png)  
have been struggling to see what the problem is. screen dump is attached I think

---

<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: [June 7, 2021, 4:40pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/2 "2021-06-07T16:40:57Z")

</div>

From the few blocks you shared, the score should change by 10 when you submit the text input but only IF the text input exactly equals the two values added together.

The problem is that the text input’s “Text” is a text string while N1’s Text + N2’s Text is a number. They are never going to equal each other.

To fix this, add zero to Text\_Input3’s Text before comparing it to the other sum.

---

<div class="post-metadata">

### Author: ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)
#### Post date: [June 7, 2021, 4:56pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/3 "2021-06-07T16:56:55Z")

</div>

Not only that hé uses the wrong set variable Block

Hé uses:

![Screenshot_20210607-185514_Chrome](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/0/60f9b47b60c1e8010cefcdf8047bc5c70e1de292.jpeg)

Instead of:

![Screenshot_20210607-185524_Chrome](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/7/77aa10deec2f6a88483e871c70dfeab2c99553a7.jpeg)

---

<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: [June 7, 2021, 5:02pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/4 "2021-06-07T17:02:23Z")

</div>

You’re right! Good catch. The way you have it set up, @meer51, you are telling Thunkable that you want to set the variable with the name of the **value** in `app variable SCORE`. So if the score is 0, you would be trying to set the variable named “0”.

Instead of using that block, try the `change variable by` block near the top of the Variables drawer.

---

<div class="post-metadata">

### Author: ![meer51](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/meer51/32/95070_2.png) [@meer51](https://community.thunkable.com/u/meer51)
#### Post date: [June 7, 2021, 5:49pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/5 "2021-06-07T17:49:58Z")

</div>

Thanks for replying. The input requested is a number because it is maths problem. The user enters a number into input.

---

<div class="post-metadata">

### Author: ![meer51](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/meer51/32/95070_2.png) [@meer51](https://community.thunkable.com/u/meer51)
#### Post date: [June 7, 2021, 5:59pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/6 "2021-06-07T17:59:45Z")

</div>

The reason I have used that block because the other is not there. The QuestNo is there but SCORE is not.

---

<div class="post-metadata">

### Author: ![meer51](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/meer51/32/95070_2.png) [@meer51](https://community.thunkable.com/u/meer51)
#### Post date: [June 7, 2021, 6:18pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/7 "2021-06-07T18:18:18Z")

</div>

Comparison work fine on inserting a correct answer it responds visually and orally . The SCORE variable does not increment.

---

<div class="post-metadata">

### Author: ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)
#### Post date: [June 7, 2021, 7:14pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/8 "2021-06-07T19:14:13Z")

</div>

It’s a drop down menu click on it and you can change the variable.  
Your current code creates a new variable variable 0 with the score as it’s value.

---

<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: [June 7, 2021, 7:33pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/9 "2021-06-07T19:33:17Z")

</div>

Just because you type in a number like 45 into a text input component doesn’t make it a “number” type in Thunkable. It will still be a text string.

The easiest way to show this is to have two text input components and compare their values to see if one is greater than the other.

If you type 22 into the first and 100 into the second and then check to see if 22 \> 100, you will see that it returns true because “22” comes after “100” alphabetically.

But if you convert each text input value to a number by adding zero to each and then compare the two new values, you will see that 22 \> 100 is now false.

---

<div class="post-metadata">

### Author: ![meer51](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/meer51/32/95070_2.png) [@meer51](https://community.thunkable.com/u/meer51)
#### Post date: [June 7, 2021, 8:27pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/10 "2021-06-07T20:27:01Z")

</div>

You are right. I did not realise you could do this to variable on left hand side of screen. It now works since I changed existing variable with drop down menu.I learnt some new today.Thanks for your reply.

---

<div class="post-metadata">

### Author: ![sketch](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/sketch/32/109058_2.png) [@sketch](https://community.thunkable.com/u/sketch)
#### Post date: [June 8, 2021, 7:01am UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/11 "2021-06-08T07:01:23Z")

</div>

You’re welcome

---

<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, 1:20pm UTC](https://community.thunkable.com/t/variable-not-incrementing/1331139/12 "2024-11-08T13:20:26Z")

</div>


