Project Spark to C# - Started To, While, and No Longer

Some of us technically new to coding, have played Project Spark and just about mastered code in it’s formalities. But switching to type of code can be very frustrating, as I am learning myself. I wish this question, and answer would have been asked and answered, for me, many days ago…

How can I duplicate Project Sparks simple functions of started to, while, and no longer?

NOTE: I will not set my answer as true, if someone has a better method, that doesn’t use more statements and if’s than mine does :slight_smile:

In the case of BUTTON PRESSED

int frames_A;
bool bool_A;

void Update(){
	if (Input.GetKey (KeyCode.A)) {
		frames_A++;
		if (bool_A != true) // To maximize performance per frame
			bool_A = true;  // bool is only called once
	}
	if (Input.GetKeyUp (KeyCode.A)) {
		frames_A = 0; // part 1 of no longer if question
	}
	if (bool_A == true) // part 2 of no longer if question
		When_A ();
}

private void When_A(){
	if (frames_A < 2) { // A was pressed do 1 frame of Logic...
		// Logic...
		// Logic...
		// Etc...
	}
	if (frames_A < 16) { // A is held down less than a 1/4 second
		// Logic...
		// Logic...
		// Etc...
	} else { // A is held down more than 1/4 second
		// Logic...
		// Logic...
		// Etc...
	}
	if (frames_A == 0) { // A is no longer pressed
		// Logic...
		// Logic... <-- NOTE
		// Etc...
		
		bool_A = false; // Stop all calls from A Button
	}   //NOTE: if any other DoSomething(); is called here, it
}       // it will still run, example 'foreach unit in game'
		// until it is done thinking...