Wait for button click in recursive function

Is it possble to have a recursive function wait for the next iteration until you Click “Space” for example

kinda like this

void Start()
{
Recursive(parameter, parameter)
}

void Recursive(parameter,parameter)
{
//some code

//wait for Key press to continue
if(statement is true)
{
Recursive(parameter, parameter)
}
else
{
return
}

i would use a corroutine for that

IEnumerator Recursive(param1, param2)//remember you need to call the recursive routine once
{
    //your stuff
    yield return new WaitUntil(Inpit.GetKeyDown(KeyCode.A));

    StartCoroutine(Recursive(param1,param2));
}