Flicker a true (mimic button press)

I’m wondering if it’s possible to have a C#/VB/Py component flicker the output from false to true and false? kind of like a button press.

for example:
input data changes, output changes False->True->False

I’ve tried to do this in C#:
A = false;
A = true;
A = false;

But the true never gets outputted, either because the compiler detects the true as unnecessary and removes it, or this flickers too fast and the other components that takes this output can’t react to it.

Can you show your whole code?

What you are currently showing is just setting A to false, then true, then false. Of course this would result in false.

that is the whole code

inside the first C# is just

A=false;
A=true;
A=false;

in the second C# it’s a script that clears all the data inside all the data recorders in the file

if((bool) resetToggle)
    {
      //going through all the objects of the grashopper document;
      foreach (object obj in GrasshopperDocument.Objects)
      {
        ///cheking only for the GH_DataRecorder T components
        if (obj is Grasshopper.Kernel.Special.GH_DataRecorder)
        {
          ///cast the T object into GH_DataRecorder
          Grasshopper.Kernel.Special.GH_DataRecorder dataDestroy = (Grasshopper.Kernel.Special.GH_DataRecorder) obj;

          ///used the nesesary methods to destroy the data and reset the rec component
          dataDestroy.DestroyRecordedData();
          dataDestroy.ExpireSolution(true);

        }
      }
    }

MY understanding is that when the data of the input on the first C# changes, the script runs itself, and it should iterate through each line of the code, so it’ll output false, true and then false; and during the instance that the output becomes true, it activates the second C# and clears all the data recorders.

Is my understanding wrong?

Well, your code certainly is. The first component does nothing but write “false” to A, then “true” to A, then false again. Everytime it runs.You have to include checks for changing inputs and such, nonoe of which is present in that script at all.
It looks like you are lacking a fundamental understanding of c# or programming in general.
Maybe one of the more GH-savy people can quickly put you on the right track.

that’s exactly what i want, except that’s not what it’s doing?
I’ve connected a slider to the C#, slide it a few times, and the values that are being recorded is only false, the “true” that’s sandwiched inbetween in not being outputted,

No. What you want is it to change every time you run the component, what you do is overwrite A(the output) three times before sending it out, effectivly sending out “false” every single time your component runs because it is the last value you send to A.
You seem to lack the very basic understanding of how variables work, I would advise you to look for a basic programming tutorial first.

For that to work in c# you will need to have things outside of the solve instance and you could use a timer potentially or a delay.

Whatever you do in the solve instance will only output the final result (in your case, false).

In Python you could use things like callback Simulate a button click with python