Coming from C/C++ land, I am wondering why the following does not work:
set a 111
if {! $a eq {} } {
puts hi
}
I know if I change the 2nd line to if { $a ne {} } { then it is fine, but cannot wrap my head around why "!" does not work.
This is because in Tcl, ! has a higher precedence than ne, so it is evaluated first.
You can check out this link for a complete list of Tcl operator precedence.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With