How to pause an execution from a script

I’m working on a Card Game on my own and i’m a bit in trouble… Basically the problem is that when the game start the code fails.

an example of the script is:

public void SinglePlayer : MonoBehaviour
{
        gameStart();
}

public void gameStart()
{
   if(myTurn)
   {
   while(CardsOnTable<1) doNothing;       //the error is here
   nextTurn();
   }
}

Here the script executes itself instantly and doesn’t stay in the “While” and doesn’t wait for me to drop the card on the table.
What can i do?

Is doNothing a function? If so, you need to call it like

doNothing();

However, having a function that does nothing doesn’t make a whole lot of sense, and on top of that, this will freeze unity, as it will never be able to exit the while loop.

What you probably want is a coroutine

 public void SinglePlayer : MonoBehaviour
 {
         StartCoroutine(gameStart());
 }
  
 public IEnumerator gameStart()
 {
    if(myTurn)
    {
    while(CardsOnTable<1) yield return null;
    nextTurn();
    }
 }