0

OK, I am a little embarrassed but I gotta ask anyway. I have a perfectly-running script that I wrapped in an infinite loop with a sleep at the end:

    while($true){}

That's all I added was this code and all of the curly braces match so why am I getting this error:

"Missing closing statement block in line x, where x is the last line in the file"

function A(){

}

while($true){

  [... Do Stuff ...]
  Start-Sleep -s 10
}

I remove the encapuslating while{} and all is fine.

Any ideas?

1 Answer 1

2

Well, the syntax posted is correct.

My guess is you retyped this into the browser, I would check all your ( ) to make sure you dont have { } in there by mistake.

Otherwise, need to copy and paste your actual code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.