Have a function wait unitl a boolean is false

Hi, I am trying to the delay a function from firing until a specific boolean is false. I found a similar post with an answer of this nature.

while(myBool)
{
    yield return null;
}

However, when i use this i get a syntax error saying it expects a semi colon. Is this C# syntax? If so, what would be the Unity-javascript equivalent? Thanks!

So long as that code is in a coroutine, you’re set to go if you use just

yield;

However, if that isn’t in a coroutine, it won’t work at all. You will freeze the game.