the if statement in TCL

前端 未结 4 780
忘掉有多难
忘掉有多难 2021-02-04 06:26

I have a question about if statement in tcl of the following code:

if {(($number == 1)&&($name == \"hello\")) || (($number == 0)&&($name == \"yes         


        
4条回答
  •  太阳男子
    2021-02-04 06:36

    I think the error message you are getting does not mean that $number has to be a boolean (I got the message expected boolean value but got "$number == 1 && $name == "hello""). It means that the string $number == 1 && $name == "hello" is not a boolean value - which is definitely true. If you use curly braces in your if expression those strings are not evaluated but are simply interpreted as they are - as a string of characters.

提交回复
热议问题