Press a key twice

Hi all,
Today I’ve got another problem:
I’d like to do a double dash in mid air

if (Input.GetKey(KeyCode.RightArrow)) {
	transform.Translate(Vector3(1, 0, 0) * Time.deltaTime * walkspeed);
	if (Input.GetKeyDown("x") && sprintcount == 0 && grounded == false) {
		transform.Translate(Vector3(5,0,0));
		sprintcount +=1;
	}
}

This is my code. It just moves right, and if I press x mid air it does a dash, but I’d like to do that when I press twice the right key mid air does the dash, and after the dash if I press right key twice again it does the dash again, how can I do that?

How I would solve this, is keep track of last time you pressed that key in a variable. Then when you press that key again, compare the previous time with the current time, if the time difference is what you would like it to be, you dash the player!

This way you have full control on how much time there has to be between 2 keystrokes as well!