# Different between "set variable" and "change variable"

**URL:** <https://community.thunkable.com/t/different-between-set-variable-and-change-variable/2284440>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [February 18, 2023, 1:16pm UTC](https://community.thunkable.com/t/different-between-set-variable-and-change-variable/2284440 "2023-02-18T13:16:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nwr](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nwr](https://community.thunkable.com/u/nwr)\
**Post date:** [February 18, 2023, 1:16pm UTC](https://community.thunkable.com/t/different-between-set-variable-and-change-variable/2284440/1 "2023-02-18T13:16:51Z")

</div>

I want to ask something. What is the difference between a variable set and a change variable?

At first, I set the value of variable = 0 which means I put in “set variable”. then I change the variable to = 1 which means I’m using “change variable”

The question is, what events happened there?

---

<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:** [February 18, 2023, 3:45pm UTC](https://community.thunkable.com/t/different-between-set-variable-and-change-variable/2284440/2 "2023-02-18T15:45:37Z")

</div>

Set variable replaces the value of the variable with the number you choose.

**Example:**

X is 2  
Set variable X to 5. Now X is 5.  
Set variable X to 22. Now X is 22.

Change variable adds or subtracts the number you choose to/from the current value of the variable.

**Example:**

X is 2.  
Change variable X by 4. Now X is 6.  
Change variable X by -3. Now X is 3.

---

<div class="post-metadata">

**Author:** ![nwr](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nwr](https://community.thunkable.com/u/nwr)\
**Post date:** [February 19, 2023, 9:44am UTC](https://community.thunkable.com/t/different-between-set-variable-and-change-variable/2284440/3 "2023-02-19T09:44:45Z")

</div>

if I look at this example,

> [@tatiang](#):
>
> X is 2.  
> Change variable X by 4. Now X is 6.

I think that the value of the variable is incremental. if that’s true, shouldn’t this one

> [@tatiang](#):
>
> Change variable X by -3. Now X is 3.

be the result is -1 ?

---

<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:** [February 19, 2023, 5:41pm UTC](https://community.thunkable.com/t/different-between-set-variable-and-change-variable/2284440/4 "2023-02-19T17:41:05Z")

</div>

No. Think of it this way:

[set variable A to 3] is the same as A=3.

[change variable B by 7] is the same as B=B+7

[change variable B by -2] is the same as B=B-2

---

<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:** [February 20, 2023, 6:27am UTC](https://community.thunkable.com/t/different-between-set-variable-and-change-variable/2284440/5 "2023-02-20T06:27:28Z")

</div>

> [@nwr](#):
>
> > [@tatiang](#):
> >
> > Change variable X by -3. Now X is 3.
> 
> be the result is -1 ?

I have to apologize… I see where I confused you. Yes, if X=2 and you change X by -3, the result would be -1. I’m so sorry, I was intending that X is 6 because of the previous line and so changing X by -3 would give you 3.

---

<div class="post-metadata">

**Author:** ![nwr](https://avatars.discourse-cdn.com/v4/letter/n/c37758/32.png) [@nwr](https://community.thunkable.com/u/nwr)\
**Post date:** [February 21, 2023, 3:11am UTC](https://community.thunkable.com/t/different-between-set-variable-and-change-variable/2284440/6 "2023-02-21T03:11:02Z")

</div>

oh it seems that i’m who doesn’t understand what you are describing. Then, it’s true that the result is 3. Okay no need to apologize.

Sorry!

---

<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:** [May 22, 2023, 3:11am UTC](https://community.thunkable.com/t/different-between-set-variable-and-change-variable/2284440/7 "2023-05-22T03:11:35Z")

</div>

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