Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
sushil353
Master II
Master II

How to toggle a variable value using single button?

Hi All,

i am encountering a situation where i have to toggle the variable value 0 to 1 and 1to 0 using a single button.

if a vaiable has initial value 1 then if i bress the button, then the value of same variable become 0

and if i press button again, variable value become 1.. and so on..

How we can achieve this..

Please help me out to solve this problem

Thanks

Sushil

1 Solution

Accepted Solutions
Not applicable

when you create a button, just set its action to 'Set Variable'.

select the variable you want to change then for the value, write in an expression like this

=if(<your_variable>=1, 0, 1)

just says that if your variable's current value is 1, it will change to 0 else it will be 1.

View solution in original post

1 Reply
Not applicable

when you create a button, just set its action to 'Set Variable'.

select the variable you want to change then for the value, write in an expression like this

=if(<your_variable>=1, 0, 1)

just says that if your variable's current value is 1, it will change to 0 else it will be 1.