How to know the flag changed from false to true?

 

I just want to know if the flag changed false to true.

Below is my just idea...

bool FLAG=false;

if (A becomes B ) FLAG=true.

if (FLAG changed from false to true) .......



How can I know the timing when the flag change?

I mean how to compare before and after flag changed?

Can I use static value?

 
Cromo:

I just want to know if the flag changed false to true.

Below is my just idea...

How can I know the timing when the flag change?

I mean how to compare before and after flag changed?

Can I use static value?

Print value of the FLAG and it writes 0 or 1 then you can compare...

if (A becomes B ) 
        {
        FLAG=true;
        Print("FLAG= ",FLAG);
        }
 

Hi,

here's another idea:

bool Flag=false;
static bool LastFlag=false;

if (A becomes B) Flag = true;

if (Flag != LastFlag) { ... }

LastFlag = Flag;


Best regards

 
Mohsen Bjp:

Print value of the FLAG and it writes 0 or 1 then you can compare...

Thank you!

 
Werner Klehr:

Hi,

here's another idea:


Best regards

I did not know that static bool is available.

I will try with this idea. Thank you!