Coroutine string array after each other.

So this is what i want to run now. This way i can pick how many i want on the go with each script.

[TextArea(3, 10)] public string[] textBoxes;

Ok so what i had was this code here and it ran one after the other depending on how many boxes were filled.

textBox.text = text1; enabledPanel.SetActive(true); yield return new WaitForSeconds(waitTime); enabledPanel.SetActive(false); if (text2 != "") { yield return new WaitForSeconds(timeBetweenText); textBox.text = text2; enabledPanel.SetActive(true); yield return new WaitForSeconds(waitTime); enabledPanel.SetActive(false);

So how can i run the array in a co routine one after the other?
I cant seem to fine anything that will help me unless i missed it by not understanding it.

Thanks in advance

private IEnumerator DoAction()
{
foreach (var textBox in textBoxes)
{
textBox.text = text1;
enabledPanel.SetActive(true);
yield return new WaitForSeconds(waitTime);
enabledPanel.SetActive(false);
if (!string.IsNullOrEmpty(text2))
{
yield return new WaitForSeconds(timeBetweenText);
textBox.text = text2;
enabledPanel.SetActive(true);
yield return new WaitForSeconds(waitTime);
enabledPanel.SetActive(false);
}
}
}
then you call StartCoroutine(DoAction());