How to tell an operand "Once" or "Started to"

This may make a few people mad, but I’m trying to convert Project Spark Logic to Unity 5.6 C#…

I am beginner to intermediate coder, and I’m trying to make this function as clean as possible, for my knowledge, and others as well. I will do my best to write my desired effect in C#:

void Update()
{
  if (intA > (intB * intC))
    {
           "Started To" intC++;
           "Started To" intD++;
    }
}

It should result in, when intA “Started to” be greater than intB * intC, intC and intD increment by 1 only one time. But when intA is less, reset. Then when intA is greater than again, increment those int’s again only one time.

NOTE: I am aware of doing this ugly, and unclean with multiple Booleans, the question is, though, Is there a more simple way?

You should use properties (variables and accessors)

private int _A;
public int A
{
    get { return _A; }
    set
    {
        if (_A != value) // only triggered when value actually changes
        {
            _A = value; // updates value
            C = _A < B*C ? 0 : C+1; // use ternary operator to assign new value to C, based on condition
            D = _A < B*C ? 0 : D+1;
        }
    }
}

Add a bool outside of the Update function…

bool startedTo = false;
 void Update()
 {
   if ((intA > (intB * intC)) && !startedTo)
     {
            startedTo = true;
            "Started To" intC++;
            "Started To" intD++;
     } else if (intA > (intB * intC))
{
// Started to is now true... do something else
}
 }

Not sure if this is what you’re wanting.

There are a bunch of different ways to accomplish this. But you really only need one boolean and simply switch to either checking greater than or less than based on the value of the boolean. You could also put this in a C# property so it only checks when intA value is updated. Or you could use delegates with anonymous functions to update the method used to check whether or not you need to take action.

If you want any clarification on any of this just let me know.