How to skip WaitForSeconds?

Hi

I’m try to skip WaitForSecond by press any keys. and skip.
I’m search for it on Google. But it Java Script and it not work.
I decide to ask. If anyone know.

Something like this?

public IEnumerator TypingMessage(string message)
{
	foreach (char letter in message.ToCharArray()) 
	{
		TypingUI.text += letter;
		if (Input.anyKey)
		{
			continue;
		}
		else 
		{
			yield return new WaitForSeconds (typingspeed);
		}
	}
	yield break;
}
//https://twitter.com/S0me_One_Else/status/981073875248103426

Remove WaitForSeconds and use a loop that tracks time. Something like this:

float elapsedTime = 0f;
while (elapsedTime < typingspeed)
{
     elapsedTime += Time.deltaTime;
     if (Input.anyKey) elapsedTime = typingspeed;
     else yield return null;
}