I have the following proc which basically looks upp a couple of values in a dictonary and returns them as a list.
proc GetAllow { PID Ply } {
# read a dictonary from a file
catch {
append PlyAndDirXt $Ply "_xt"
append PlyAndDirYt $Ply "_yt"
set x_allow_tens [ dict get $allowables $PID $PlyAndDirXt ]
set y_allow_tens [ dict get $allowables $PID $PlyAndDirYt ]
set allowables [ list $x_allow_tens $y_allow_tens ]
} res
if { $res == 0 } {
return $allowables
}
if { $res != 0 } {
return 999
}
}
As I understand "catch" if everything is ok $res should be 0 = TCL_OK. In that case I would like the proc to return the list $allowables. In case the values are not found in the dict due to none matching keys. I would like it to return 999. But I always get 999 back. What am I'm doing wrong here ?