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

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?

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.

if I look at this example,

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

be the result is -1 ?

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

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.

1 Like

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!

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