how to use logic for button click
I have one button and i wnt to 1st time click on button show something and second time click on button show something
You can use a math variable for that, when a button is clicked add 1 to the variable and you can use if then else block to code that when variable value = 1 or 2 then put whatever you want
You can do it by changing button text, by using tiny db, by using global variable…
use your logic…
I think you want something like double back press to exit.
You should search about this in community.
This is basic Programming Logic. You need something (called a variable) to differentiate the first click from the second click. Realize that this can only be done through numbers. Therefore, you will have to create a variable that is numeric because you will have to receive the values 0, 1 and 2. Maybe the first problem solved if you do not need to save the variable in a database. Now you must define when the variable will change its value. Note that the variable will receive an increase of 1 unit. You also need to define what will happen to the variable after the second click. First click - variable receives the value 1 Second click - the variable receives value 2 And from the third click?
you can do it like this
This is the same what I said, you have just showed it in blocks
i know that
So you should specify that if your code works then he should mark my post as solution
Why me? It is for OP. Then he should specify it
Yes, but since you have just provided what I said that’s why I told you
Use blocks with if statement.
Var=0
On click:
Var=Var+1
If Var=1 then do x
If Var=2 the Var=0 do y
I used this code thanks to Ken for this code and all of u also for try
Why is his post marked as solution?
I said the same thing
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.