0

I am trying to check the value of a variable in a while loop

 set resultReturn 0
 while {expr $resultReturn == 0} {
    # Apply the stream configurations.
    set resultReturn [stc::apply]
 }

I am getting the following error:

syntax error in expression "expr $resultReturn == 0": variable references require preceding $

What should be the correct way to check the variable in an infinite loop until it changes value from 0?

1
  • Though given your error message, I would check resultReturn and make sure you are getting a valid numeric value back. Commented Nov 30, 2016 at 16:36

1 Answer 1

3

While takes a test as its first argument and processes it in the same manner as expr.

while { $resultReturn == 0 } {

References: while

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.